University Management System In C++ - C++ Programming Tutorial
C++ Course / Miscellaneous / University Management System In C++

University Management System In C++

BLUF: Mastering University Management System In C++ is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: University Management System In C++

C++ is renowned for its efficiency. Learn how University Management System In C++ enables low-level control and high-performance computing in the tutorial below.

In academic institutions, extensive data analysis is conducted, with the findings applied to organizational management. The university management system maintains current records of various colleges, their diverse academic disciplines, and the department responsible for overseeing examinations and results. The project outcome includes structured menus and submenus, enhancing its organized layout.

The object-oriented framework supporting the University Management System is developed using the C++ coding language. This system primarily oversees the assortment of colleges affiliated with the university and the wide array of educational programs they offer. Moreover, the project incorporates a robust menu interface to oversee and oversee the examination and results sections effectively.

Program Breakdown

Example

#include<iostream>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<fstream>
#include<algorithm>
using namespace std;

Incorporating all essential files to prevent any form of error.

Example

class student
{
    public:
        long int reg;
        char name[80],branch[50];
        void input()
        {
            cout<<"\n Enter name: ";
            gets(name);
            cout<<"\n Enter roll no: ";
            cin>>reg;
            fflush(stdin);
            cout<<"\n Enter Branch: ";
            gets(branch);
        }
        void display()
        {
            system("CLS");
            cout<<"\t\tDisplay Records";
            cout<<"\n";
            cout<<"\n Name - "<<name;
            cout<<"\n Reg no. - "<<reg;
            cout<<"\n Branch - "<<branch;
            cout<<"\n";
            system("PAUSE");
            system("CLS");
        }
        bool operator == (student a)
        {
            if(reg==a.reg)
                return true;
            else
                return false;
        }
};
vector <student>v;

The code snippet above is designed to define a class for students, incorporating data variables such as ```

include<iostream>

include<vector>

include<stdio.h>

include<cstring>

include<fstream>

include<algorithm>

using namespace std;

Example


int search_reg(long int reg, int &i);

void get_file

{

student x;

int i=0;

fstream f;

f.open("College.txt",ios::in);

if(f)

{

f.read((char *) &x,sizeof(class student));

while(!f.eof)

{

v.push_back(x);

f.read((char *) &x,sizeof(class student));

}

}

else

;

f.close;

}

Example


The aforementioned code snippet retrieves the file named college.txt.

void bubblesort

{

int i,j;

student x;

for(i=0;i<v.size;i++)

for(j=0;j<v.size-i-1;j++)

if(v[j].reg>v[j+1].reg)

{

x=v[j];

v[j]=v[j+1];

v[j+1]=x;

}

}

Example


The code above is designed to arrange the students' records using a bubble sort technique, resulting in a time complexity of O(n^2).

void bubblesort

{

int i,j;

student x;

for(i=0;i<v.size;i++)

for(j=0;j<v.size-i-1;j++)

if(v[j].reg>v[j+1].reg)

{

x=v[j];

v[j]=v[j+1];

v[j+1]=x;

}

}

Example


The code snippet above is designed to add fresh information into the database of college students.

void bubblesort

{

int i,j;

student x;

for(i=0;i<v.size;i++)

for(j=0;j<v.size-i-1;j++)

if(v[j].reg>v[j+1].reg)

{

x=v[j];

v[j]=v[j+1];

v[j+1]=x;

}

}

Example


The code snippet above is responsible for writing the output generated by the bubble sort algorithm applied to the college students' data into the college.txt file.

int search_reg(long int reg, int &i)

{

int ta=0;

for(i=0;i<v.size;i++)

if(v[i].reg==reg)

{

ta=1;

break;

}

return ta;

}

Example


The aforementioned code snippet is utilized to search for a student's registration in the college within the data file specifically designed for student records.

int search_name(char name, vector<int> &vi)

{

int i,ta=0;

for(i=0;i<v.size;i++)

if(strcmp(v[i].name,name)==0)

{

ta=1;

vi.push_back(i);

}

return ta;

}

Example


The aforementioned code snippet is utilized to search for a student's name within the record file specifically designed for that student.

int search_branch(char branch, vector<int> &vj)

{

int i,ta=0;

for(i=0;i<v.size;i++)

if(strcmp(v[i].branch,branch)==0)

{

ta=1;

vj.push_back(i);

}

return ta;

}

Example


The above code will use to search the branch.

void searchandshow

{

int ch,i,ta=0;

char name[80],branch[50];

vector <int>vi;

vector <int>vj;

long int reg;

poi:

cout<<"\n1.Press to search reg no."

<<"\n2.Press to search name"

<<"\n3.Press to search branch";

cin>>ch;

switch(ch)

{

case 1:

cout<<"\nEnter reg no.: ";

cin>>reg;

if(search_reg(reg,i)==1)

v[i].display;

else

cout<<"\nRecord NOT FOUND!!!";

break;

case 2:

cout<<"\nEnter name: ";

fflush(stdin);

gets(name);

if(search_name(name,vi)==1)

{

for(int j=0;j<vi.size;j++)

v[vi[j]].display;

}

else

cout<<"\nRecord NOT FOUND!!!";

break;

case 3:

cout<<"\nEnter branch: ";

fflush(stdin);

gets(branch);

if(search_branch(branch,vj)==1)

{

for(int j=0;j<vj.size;j++)

v[vj[j]].display;

}

else

cout<<"\nRecord NOT FOUND!!!";

break;

default:

cout<<"\nWrong CHOICE!!!";

goto poi;

}

}

void show

{

int i;

for(i=0;i<v.size;i++)

v[i].display;

}

Example


The above code will use to show the result.

void delete_data

{

int i,j;

long int reg;

vector <student>::iterator p=v.begin;

cout<<"\nEnter Reg. no.: ";

cin>>reg;

if(search_reg(reg,i)==1)

{

student x=v[i];

cout<<"\nThe following data is being deleted";

x.display;

p+=i;

v.erase(p,p+1);

}

}

Example


The code snippet above is employed to remove the stored information.

void edit_data

{

int i,j;

long int reg;

vector <student>vi;

cout<<"\nEnter Reg. no.: ";

cin>>reg;

if(search_reg(reg,i)==1)

{

cout<<"\nEnter new data:";

fflush(stdin);

v[i].input;

}

}

Example


The above code will use to edit the data.

int main

{

int i=1;

get_file;

while(i)

{

system("CLS");

cout<<"\t\t\t-----------------------------------------\n";

cout<<"\t\t\t University Management System\n";

cout<<"\t\t\t-----------------------------------------\n";

cout<<"\n\t\t\tEnter <1> to Add new student"

<<"\n\t\t\tEnter <2> to Display all student"

<<"\n\t\t\tEnter <3> to Remove student"

<<"\n\t\t\tEnter <4> to Edit student"

<<"\n\t\t\tEnter <5> to Search student"

<<"\n\t\t\tEnter <0> to Exit\n";

cout<<"\n\n\t\t\tEnter Your Choice:";

cin>>i;

switch(i)

{

case 1 :

insert_new;

break;

case 2 :

show;

break;

case 3 :

delete_data;

break;

case 4 :

edit_data;

break;

case 5 :

searchandshow;

break;

case 0 :

write_file;

break;

default :

cout<<"\nWRONG CHOICE!!!\nTRY AGAIN";

}

}

return 0;

}

Example


The code snippet above will represent the switch cases for the system.

OUTPUT

-----------------------------------------

University Management System

-----------------------------------------

Enter <1> to Add new student

Enter <2> to Display all student

Enter <3> to Remove student

Enter <4> to Edit student

Enter <5> to Search student

Enter <0> to Exit

Enter Your Choice:1

Enter name: John Miller

Enter roll no: 1001

Enter Branch: Computer Science

Press [Y] to enter more: Y

Enter name: Daisy Smith

Enter roll no: 1002

Enter Branch: Computer Science

Press [Y] to enter more: N

-----------------------------------------

University Management System

-----------------------------------------

Enter <1> to Add new student

Enter <2> to Display all student

Enter <3> to Remove student

Enter <4> to Edit student

Enter <5> to Search student

Enter <0> to Exit

Enter Your Choice:2

Display Records

Name - John Miller

Reg no.- 1001

Branch - Computer Science

Name - Daisy Smith

Reg no. - 1002

Branch - Computer Science

Press any key to continue . . .

Example


Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience