Cpp Project - Student Report Card System Project

Published January 19, 2022

Today we  are going to write a project Student record system project in C++ with simple and easy code. Basically, we are going to implement different features to create, search, display,  delete,  or modify student result. There are many more features we are going to use in the student result record system project. Let's have a brief look at the features of this RRS(result record system) project

 

Features of Student Record System

Students Details- We will be able to add or update the student details such as name, roll number and marks, etc. These details will be stored in different variables.

Create/Display/Search/Modify/Delete result - This   result record system project will be programmed to Create/Display/Search/Modify/Delete  record easily that will make it more efficient

 

 This C++ project will include all the complete details of Students

Project Explanation:

In MAIN MENU ,There are 3 option

01. RESULT MENU

 02. ENTRY/EDIT MENU

 03. EXIT

int main()

{

  char ch;

  cout.setf(ios::fixed|ios::showpoint);

  cout<<setprecision(2); // program outputs decimal number to two decimal places

  intro();

  do

  {

    system("cls");

    cout<<"\n\n\n\tMAIN MENU";

    cout<<"\n\n\t01. RESULT MENU";

    cout<<"\n\n\t02. ENTRY/EDIT MENU";

    cout<<"\n\n\t03. EXIT";

    cout<<"\n\n\tPlease Select Your Option (1-3) ";

    cin>>ch;

    switch(ch)

    {

      case '1': result();

      break;

      case '2': entry_menu();

      break;

      case '3':

        break;

      default :cout<<"\a";

    }

  }while(ch!='3');

  return 0;

}

 

Cpp Projects Student Record System

RESULT MENU 

In RESULT MENU 

 1. Class Result

2. Student Report Card

3. Back to Main Menu

int main()
{
  char ch;
  cout.setf(ios::fixed|ios::showpoint);
  cout<<setprecision(2); // program outputs decimal number to two decimal places
  intro();
  do
  {
    system("cls");
    cout<<"\n\n\n\tMAIN MENU";
    cout<<"\n\n\t01. RESULT MENU";
    cout<<"\n\n\t02. ENTRY/EDIT MENU";
    cout<<"\n\n\t03. EXIT";
    cout<<"\n\n\tPlease Select Your Option (1-3) ";
    cin>>ch;
    switch(ch)
    {
      case '1': result();
      break;
      case '2': entry_menu();
      break;
      case '3':
        break;
      default :cout<<"\a";
    }
  }while(ch!='3');
  return 0;
}

 

Cpp Projects Student Record System9

The class result will show the result of the whole class.

void class_result()
{
  student st;
  ifstream inFile;
  inFile.open("student.dat",ios::binary);
  if(!inFile)
  {
    cout<<"File could not be open !! Press any Key...";
    cin.ignore();
    cin.get();
    return;
  }
  cout<<"\n\n\t\tALL STUDENTS RESULT \n\n";
  cout<<"==========================================================\n";
  cout<<"R.No   Name      P   C   M   E   CS   %age   Grade"<<endl;
  cout<<"==========================================================\n";
  while(inFile.read(reinterpret_cast<char *> (&st), sizeof(student)))
  {
  st.show_tabular();
  }
  cin.ignore();
  cin.get();
  inFile.close();
}

 

Cpp Projects Student Record System8

 

Student  Report  Card will show the result of  a single student. You have to enter the roll number of that student.

void student::showdata() const
{
cout<<"\nRoll number of student : "<<rollno;
cout<<"\nName of student : "<<name;
cout<<"\nMarks in Physics : "<<p_marks;
cout<<"\nMarks in Chemistry : "<<c_marks;
cout<<"\nMarks in Maths : "<<m_marks;
cout<<"\nMarks in English : "<<e_marks;
cout<<"\nMarks in Computer Science :"<<cs_marks;
cout<<"\nPercentage of student is  :"<<per;
cout<<"\nGrade of student is :"<<grade;
}

void student::show_tabular() const
{
cout<<rollno<<setw(6)<<" "<<name<<setw(10)<<p_marks<<setw(4)<<c_marks<<setw(4)<<m_marks<<setw(4)
<<e_marks<<setw(4)<<cs_marks<<setw(8)<<per<<setw(6)<<grade<<endl;
}

int  student::retrollno() const
{
return rollno;
}

 

Cpp Projects Student Record System2

 

02. ENTRY/EDIT MENU

        1.CREATE STUDENT RECORD

        2.DISPLAY ALL STUDENTS RECORDS

        3.SEARCH STUDENT RECORD

        4.MODIFY STUDENT RECORD

        5.DELETE STUDENT RECORD

void entry_menu()
{
  char ch;
  int num;
  system("cls");
  cout<<"\n\n\n\tENTRY MENU";
  cout<<"\n\n\t1.CREATE STUDENT RECORD";
  cout<<"\n\n\t2.DISPLAY ALL STUDENTS RECORDS";
  cout<<"\n\n\t3.SEARCH STUDENT RECORD ";
  cout<<"\n\n\t4.MODIFY STUDENT RECORD";
  cout<<"\n\n\t5.DELETE STUDENT RECORD";
  cout<<"\n\n\t6.BACK TO MAIN MENU";
  cout<<"\n\n\tPlease Enter Your Choice (1-6) ";
  cin>>ch;
  system("cls");
  switch(ch)
  {
    case '1':    write_student(); break;
    case '2':    display_all(); break;
    case '3':    cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
    display_sp(num); break;
    case '4':    cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
    modify_student(num);break;
    case '5':    cout<<"\n\n\tPlease Enter The roll number "; cin>>num;
    delete_student(num);break;
    case '6':    break;
    default:    cout<<"\a"; entry_menu();
  }
}

 

Cpp Projects Student Record System10

 

 

 1. CREATE STUDENT RECORD

Inside create student result we will enter student roll number name and subject marks

void write_student()
{
  student st;
  ofstream outFile;
  outFile.open("student.dat",ios::binary|ios::app);
  st.getdata();
  outFile.write(reinterpret_cast<char *> (&st), sizeof(student));
outFile.close();
cout<<"\n\nStudent record Has Been Created ";
cin.ignore();
cin.get();
}

Cpp Projects Student Record System11

 

 2.  DISPLAY ALL STUDENTS RECORDS

All the created results can be seen inside the display result

void display_all()
{
  student st;
  ifstream inFile;
  inFile.open("student.dat",ios::binary);
  if(!inFile)
  {
    cout<<"File could not be open !! Press any Key...";
    cin.ignore();
    cin.get();
    return;
  }
  cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";
  while(inFile.read(reinterpret_cast<char *> (&st), sizeof(student)))
  {
  st.showdata();
  cout<<"\n\n====================================\n";
  }
  inFile.close();
  cin.ignore();
  cin.get();
}

 

Cpp Projects Student Record System

 

3. SEARCH STUDENT RECORD

Inside the search result, the registered student can search the result by entering the roll number

void display_sp(int n)
{
  student st;
  ifstream inFile;
  inFile.open("student.dat",ios::binary);
  if(!inFile)
  {
    cout<<"File could not be open !! Press any Key...";
    cin.ignore();
    cin.get();
    return;
  }
  bool flag=false;
  while(inFile.read(reinterpret_cast<char *> (&st), sizeof(student)))
  {
  if(st.retrollno()==n)
  {
  st.showdata();
  flag=true;
  }
  }
  inFile.close();
  if(flag==false)
cout<<"\n\nrecord not exist";
cin.ignore();
cin.get();
}

 

Cpp Projects Student Record System4

 

4. MODIFY STUDENT RECORD

By entering the student roll number inside the modified result, we can modify the result of that student

void modify_student(int n)
{
  bool found=false;
  student st;
  fstream File;
  File.open("student.dat",ios::binary|ios::in|ios::out);
  if(!File)
  {
    cout<<"File could not be open !! Press any Key...";
    cin.ignore();
    cin.get();
    return;
  }
  while(!File.eof() && found==false)
  {

    File.read(reinterpret_cast<char *> (&st), sizeof(student));
if(st.retrollno()==n)
  {
  st.showdata();
  cout<<"\n\nPlease Enter The New Details of student"<<endl;
  st.getdata();
  int pos=(-1)*static_cast<int>(sizeof(st));
  File.seekp(pos,ios::cur);
  File.write(reinterpret_cast<char *> (&st), sizeof(student));
  cout<<"\n\n\t Record Updated";
  found=true;
  }
  }
  File.close();
  if(found==false)
cout<<"\n\n Record Not Found ";
cin.ignore();
cin.get();
}

 

5. DELETE STUDENT RECORD

Delete the result of the registered student by entering the roll number of that student

void delete_student(int n)
{
  student st;
  ifstream inFile;
  inFile.open("student.dat",ios::binary);
  if(!inFile)
  {
    cout<<"File could not be open !! Press any Key...";
    cin.ignore();
    cin.get();
    return;
  }
  ofstream outFile;
  outFile.open("Temp.dat",ios::out);
  inFile.seekg(0,ios::beg);
  while(inFile.read(reinterpret_cast<char *> (&st), sizeof(student)))
  {
  if(st.retrollno()!=n)
  {
  outFile.write(reinterpret_cast<char *> (&st), sizeof(student));
  }
  }
  outFile.close();
  inFile.close();
remove("student.dat");
rename("Temp.dat","student.dat");
  cout<<"\n\n\tRecord Deleted ..";
  cin.ignore();
  cin.get();
}

 

Cpp Projects Student Record System6

 

Class result after deleted

 

Cpp Projects Student Record System5

 

CONCLUSION:-

This is a just simple C++ Project to create Library Result Record System. To make this project as your Academic Project add More modules and feature to this project

 

Related Cpp Projects:

Library Management System

Cpp Employee Management System

Cpp bank Management System

 

Download Source code

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

1890 Views