Skip to main content

Posts

Showing posts from June, 2022

Sequential File Handling using CPP to store data of studenets

  Problem Statement:- Department maintains student information. The file contains the roll number, name, division and address. Allow user to add, and delete information of student. Display information about a particular student. If the record of the student does not exist an appropriate message is displayed. If it is, then the system displays the student details. Use the sequential file to maintain the data. Note :- Scroll horizontally to see the full line of code. #include < iostream > #include < fstream > #include < cstring > #include < iomanip > using namespace std ; const int MAX = 20 ; class Student {     int rollno ;     char name [ 20 ], city [ 30 ];     int div ;     int year ; public :     Student ()     {         strcpy ( name , "" );         strcpy ( city , "" );         rollno = year = div = 0 ;    ...

Implementation of Heap Sort using CPP | Heapify Function

  Problem Statement:- Implement the Heap sort algorithm implemented in CPP demonstrating heap data structure with the modularity of programming language. Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class heap {     int n ;     int * array ; public :     heap ( int n ) {         this -> n = n ;         array = new int [ n ];     }     void inputheap ();     void swap ( int i , int j );     void heapify ( int size , int i );     void heapSort ();     void printheap (); }; void heap :: inputheap () {     cout << " Enter elements: " << endl ;     for ( int i = 0 ; i < n ; i ++ ) {         cout << i << " : " ;         cin >> array [ i ];     } } void he...

Topological Sort of Graph using CPP | Representation of Graph using Adjacency List

  Problem Statement:- Write a C++ program to implement topological sorting on graph using object-oriented programming features. Design necessary class (Use of Graph). Note :- Scroll horizontally to see the full line of code. #include < iostream > using namespace std ; class flagarray {     char data ;     int flag ; public :     flagarray () {         this -> data = ' * ' ;         this -> flag = 0 ;     }     flagarray ( char data , int flag ) {         this -> data = data ;         this -> flag = flag ;     }     friend class node ;     friend class graph ;     friend class stack ; }; class stack {     int top = - 1 ;     char arr [ 30 ]; public :     bool isFull ();     bool isEmpty ();     void push ( char data );...