How To Make Student Record System in C++ | C++ Project

by | Jan 1, 2022 | C/C++, Coding

Introduction

This article will help you to make a student record system project in C++. The project discussed in this article is designed to manage the student’s records related to their report cards. It is a straightforward C++ project for beginners to understand programming concepts by implementing such valuable projects. It includes the idea of following topics like structure, loops, arrays, if-else, switch, and so on. So hopefully, after creating this project, your basic C++ concepts will be clear.

 

Objectives

The Student Record System Project in C++ is beneficial because managing big data is impossible manually. Thus, applications like this are very beneficial and are developed with the following objectives:

  • To improve the management of student enrolment
  • For Centralized management of bills and accounts
  • To efficiently manage all activities related to students.

Requirements

To run this project, you must have installed IDE for running and compiling the C++ source code. We recommend Dev C++ or Code Blocks for a better experience.

Refer to the links below to download the Dev C++ or Code Blocks IDE.

https://sourceforge.net/projects/embarcadero-devcpp/

https://sourceforge.net/projects/codeblocks/

Source Code

#include <iostream>
#include<fstream>
#include<windows.h>
using namespace std;
struct student
{
char name[80];
char id[80];
int roll;
float pro,arc,writing,alg,sum,average;
};
void intro();
void mainmenu();
void acceptdata();
void view_Specific(int);
void viewall();
void result(int);
void deleterecord(int);
void modify(int);
int main()
{
    system("color a");
    char c;
    system("cls");
    intro();
    do{
   system("cls");
   system("color e");
   cout<<"\n\n";
   cout<<"\t====================STUDENT REPORT CARD MANEGEMENT SYSTEM===================="<<endl;
   cout<<endl;
   cout<<"\t\t\t\t1. MAIN MENU\n\n";
   cout<<"\t\t\t\t2. EXIT\n\n";
   cout<<"ENTER YOUR CHOICE :";
   cin>>c;
   system("cls");
   switch(c)
   {
   case '1':
    {
        mainmenu();
        break;
    }
   case '2':
    {          cout << "\t\t     THANK YOU FOR USING THIS SOFTWARE"<<endl;
        cout << "\n\n";
             cout<<"\t   GROUP MEMBERS(DEVELOPERS)";
             cout << "\n\n";
             cout << "\t   NAME                               ID                 PHONE NUMBER \n\n";
             cout << "\t   1. BIRUK ABERE                 GUE/01182/11          +251974461688   \n\n";
             cout << "\t   2. YONATAN MELESE              GUE/01446/11          +251926489069    \n\n";
             cout << "\t   3. AMANUEL CHALACHEW           GUE/01479/11          +251941257770     \n\n";
             cout << "\t   4. BINIYAM YOSEF               GUE/01480/11          +251946230602      \n\n";
             cout << "\t   5. ABEL WONDMU                 GUE/01424/11          +251965311410       \n\n";
              cout << "\n\n";
             cout<<"\t\t\t\t\t\t\t\t\t   SUBMITED TO:   KIDIST AMDE\n";
             cout<<"\t\t\t\t\t\t\t\t\t   SUBMITED DATE: 22/10/2011 ";
              cout << "\n\n";
    }
   }
    }while(c!='2');
    return 0;
}
void acceptdata()
{
    system("cls");
    student s;
    ofstream outfile;
    outfile.open("Report.txt",ios::app|ios::binary);
    if(outfile.fail())
    {
        cout<<"THE FILE COULD NOT BE OPEN...press enter key";
        cin.ignore();
        cin.get();
    }
    cout<<"\n\n";
    cout<<"\t\t\t\t=======CREATE A REPORT CARD========\n\n";
    cout<<"ENTER YOUR FULL NAME :";
    cin.ignore();
    cin.getline(s.name,80);
    cout<<"ENTER YOUR ID NUMBER : GUE/";
    cin.ignore();
    cin.get(s.id,80);
    cout<<"ENTER YOUR ROLL NUMBER :";
    cin>>s.roll;
    cout<<"ENTER YOUR PROGRAMMING MARK :";
    cin>>s.pro;
    cout<<"ENTER YOUR COMPUTER ARCITECTURE MARK :";
    cin>>s.arc;
    cout<<"ENTER YOUR WRITING SKILL MARK :";
    cin>>s.writing;
    cout<<"ENTER YOUR ALGEBRA MARK :";
    cin>>s.alg;
    s.sum=s.pro+s.arc+s.writing+s.alg;
    s.average=(s.sum/4);
    outfile.write(reinterpret_cast<char *> (&s), sizeof(student));
    outfile.close();
    cout<<endl;
    cout<<"\t\t\t\tTHE FILE IS SUCCESSFULLY SAVED"<<endl;
    cout<<endl;
    cout<<"press any key to continue...";
    cin.ignore();
    cin.get();
}
void intro()
{
    cout << "\n\n\n";
    Sleep(300);
    cout << "\t\t\t\t * * *  **** *      ****  ***   ***   ****   " << endl;
    Sleep(300);
    cout << "\t\t\t\t * * * *     *     *     *   * * * * *        "<< endl;
    Sleep(300);
    cout << "\t\t\t\t * * * ***** *     *     *   * * * * *****    " << endl;
    Sleep(300);
    cout << "\t\t\t\t * * * *     *     *     *   * * * * *         " << endl;
    Sleep(300);
    cout << "\t\t\t\t  ***   **** *****  ****  ***  * * *  ****     " << endl;
    Sleep(300);
    cout<<endl;
    cout<<"\t\t\t\t============================================="<<endl;
    Sleep(500);
    cout<<"\t\t\t\tTHIS IS STUDENT REPORT CARD MANEGEMENT SYSTEM"<<endl;
    Sleep(500);
    cout<<"\t\t\t\t============================================="<<endl;
    Sleep(500);
    cout<<"press any key to continue...";
    cin.ignore();
    cin.get();
}
void mainmenu()
{
    system("color c");
    char cc;
    cout<<"\t\t\t\t=================MAIN MENU================\n\n"<<endl;
    Sleep(300);
    cout<<"\t\t\t\t1. CREATE STUDENT REPORT CARD\n\n"<<endl;
     Sleep(300);
    cout<<"\t\t\t\t2. VIEW ALL STUDENTs REPORT CARD\n\n"<<endl;
     Sleep(300);
    cout<<"\t\t\t\t3. VIEW A SINGLE STUDENT REPORT CARD\n\n"<<endl;
     Sleep(300);
    cout<<"\t\t\t\t4. MODIFY REPORT CARD\n\n"<<endl;
     Sleep(300);
    cout<<"\t\t\t\t5. RESULT\n\n"<<endl;
     Sleep(300);
     cout<<"\t\t\t\t6. DELETE RECORD\n\n"<<endl;
     Sleep(300);
    cout<<"\t\t\t\t=============================="<<endl;
     Sleep(300);
    cout<<"\t\t\t\tENTER YOUR CHOICE...:) <1-6> :";
     Sleep(300);
    cin>>cc;
    cout<<endl;
    switch(cc)
    {
    case '1':
        {
            acceptdata();
            break;
        }
    case '2':
        {
            viewall();
            break;
        }
    case '3':
          {
              int n;
              cout<<"ENTER YOUR ROLL NUMBER :";
              cin>>n;
              view_Specific(n);
              break;
          }
    case '4':
        {
            int n;
            cout<<"ENTER YOUR ROLL NUMBER :";
            cin>>n;
            modify(n);
            break;
        }
    case '5':
        {
            int n;
            cout<<"ENTER YOUR ROLL NUMBER :";
            cin>>n;
            cout<<endl;
            result(n);
            break;
        }
    case '6':
        {
            int n;
            cout<<"ENTER YOUR ROLL NUMBER :";
            cin>>n;
            cout<<endl;
            deleterecord(n);
            break;
        }
    }
}
void viewall()
{
    system("cls");
    student s;
    ifstream infile;
    bool check=false;
    infile.open("Report.txt",ios::app|ios::binary);
    if(infile.fail())
    {
        cout<<"THE FILE COULD NOT BE OPENED.....press enter key...";
        cin.ignore();
        cin.get();
    }
     cout<<"\n\n";
     cout<<"\t\t\t\tALL STUDENTS REPORT CARDS"<<endl;
     cout<<"=================================================================================="<<endl;
    while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
    {
        cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
        cout<<"\t\t\t\tSTUDENT ID NUMBER :GUE/"<<s.id<<endl<<endl;
        cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll<<endl<<endl;
        cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.pro<<endl<<endl;
        cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arc<<endl<<endl;
        cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing<<endl<<endl;
        cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg<<endl<<endl;
        cout<<"\t\t\t\tSUM :"<<s.sum<<endl<<endl;
        cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl<<endl;
        cout<<"=================================================================================="<<endl;
        check=true;
    }
    infile.close();
    if(check==false)
    cout<<"\t\t\t\tNO RECORD FOUND..."<<endl<<endl;
    cout<<"press any key to continue....";
    cin.ignore();
    cin.get();
}
void view_Specific(int n)
{
    system("cls");
    student s;
    ifstream infile;
    infile.open("Report.txt",ios::app|ios::binary);
    if(infile.fail())
    {
        cout<<"THE FILE COULD NOT BE OPENED...";
        cin.ignore();
        cin.get();
    }
    bool equality=false;
    cout<<"\t\t\t\t==========VIEW A SINGLE STUDENT REPORT==========\n\n";
    while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
    {
        if(s.roll==n)
        {
        cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl;
        cout<<"\t\t\t\tSTUDENT ID NUMBER :GUE/"<<s.id<<endl;
        cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll<<endl;
        cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.pro<<endl;
        cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arc<<endl;
        cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing<<endl;
        cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg<<endl;
        cout<<"\t\t\t\tSUM :"<<s.sum<<endl;
        cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl;
        cout<<"\t\t\t\t================================================"<<endl;
        equality=true;
        }
    }
        infile.close();
        if(equality==false)
            cout<<"\t\t\t\tRECORD NOT FOUND..."<<endl;
            cout<<endl;
            cout<<"press any key to continue...";
            cin.ignore();
            cin.get();
}
void result(int n)
{
    system("cls");
    student s;
    ifstream infile;
    infile.open("Report.txt",ios::app|ios::binary);
    if(infile.fail())
    {
        cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
        cin.ignore();
        cin.get();
    }
    bool eq=false;
    cout<<"\t\t\t\t===========VIEW A SINGLE STUDENT RESULT==========\n\n";
    while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
    {
        if(s.roll==n)
        {
        cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
        cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.pro<<endl<<endl;
        cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arc<<endl<<endl;
        cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing<<endl<<endl;
        cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg<<endl<<endl;
        cout<<"\t\t\t\tSUM :"<<s.sum<<endl<<endl;
        cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl<<endl;
        cout<<"\t\t\t\t=================================================="<<endl;
        eq=true;
        }
    }
        infile.close();
        if(eq==false)
            cout<<"\t\t\t\tRECORD NOT FOUND..."<<endl;
            cout<<endl;
            cout<<"press any key to continue...";
            cin.ignore();
            cin.get();
}
void modify(int n)
{
    system("cls");
    student s;
    fstream infile;
    infile.open("Report.txt",ios::binary|ios::in|ios::out);
    if(infile.fail())
    {
        cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
        cin.ignore();
        cin.get();
    }
     bool checker=false;
     cout<<"\t\t\t\t==========MODIFY A REPORT CARD==========\n\n";
     while(!infile.eof() && checker==false)
     {
     infile.read(reinterpret_cast<char*>(&s),sizeof(student));
     {
         if(s.roll==n)
         {
        cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
        cout<<"\t\t\t\tSTUDENT ID NUMBER :GUE/"<<s.id<<endl<<endl;
        cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll<<endl<<endl;
        cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.pro<<endl<<endl;
        cout<<"\t\t\t\tCOMPUTER ARCHITECTURE MARK :"<<s.arc<<endl<<endl;
        cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing<<endl<<endl;
        cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg<<endl<<endl;
        cout<<"============================================="<<endl;
        cout<<"\t\tENTER THE NEW INFORMATION"<<endl;
        cout<<"============================================="<<endl;
        cout<<"ENTER YOUR FULL NAME :";
    cin.ignore();
    cin.getline(s.name,80);
    cout<<"ENTER YOUR ID NUMBER : GUE/";
    cin.ignore();
    cin.get(s.id,80);
    cout<<"ENTER YOUR ROLL NUMBER :";
    cin>>s.roll;
    cout<<"ENTER YOUR PROGRAMMING MARK :";
    cin>>s.pro;
    cout<<"ENTER YOUR COMPUTER ARCITECTURE MARK :";
    cin>>s.arc;
    cout<<"ENTER YOUR WRITING SKILL MARK :";
    cin>>s.writing;
    cout<<"ENTER YOUR ALGEBRA MARK :";
    cin>>s.alg;
    s.sum=s.pro+s.arc+s.writing+s.alg;
    s.average=(s.sum/4);
    int pos=(-1)*static_cast<int>(sizeof(student));
    infile.seekp(pos,ios::cur);
    infile.write(reinterpret_cast<char *> (&s), sizeof(student));
    cout<<endl;
    cout<<"\t\t\t\tTHE FILE IS SUCCESSFULLY updated"<<endl;
    checker=true;
         }
     }
     }
     infile.close();
         if(checker==false)
            cout<<"\t\t\t\tRECORD NOT FOUND"<<endl;
            cout<<endl;
            cout<<"press any key to continue...";
            cin.ignore();
            cin.get();
  }
  void deleterecord(int n)
  {
     system("cls");
     student s;
     ifstream infile;
     infile.open("Report.txt",ios::binary);
     if(!infile)
     {
         cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
         cin.ignore();
         cin.get();
     }
     ofstream outfile;
     outfile.open("Record2.txt",ios::binary);
     infile.seekg(0,ios::beg);
     cout<<"\t\t\t\t===========DELETE A REPORT CARD==========\n\n";
     while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
     {
         if(s.roll!=n)
         {
             outfile.write(reinterpret_cast<char*>(&s),sizeof(student));
         }
     }
     infile.close();
     outfile.close();
     remove("Report.txt");
     rename("Record2.txt","Report.txt");
     cout<<endl;
     cout<<"\t\t\t\tRECORD SUCCESSFULLY DELETED"<<endl;
     cout<<"press any key to continue...";
     cin.ignore();
     cin.get();
  }

Explanation Of The Code

1. The major functions of this program are

  • Insert Record
  • Show all Record
  • Search Record
  • Exit Program

2. Each function has a function call in switch statements that works as per the user’s control.

3. The various user-defined functions discussed above contribute to the proper functioning of this student record system project.

4. The home screen is designed so that it greets the user with a ‘WELCOME’ and a menu appears with two options.

5. The main menu has six options through which we can create, view, modify, and delete the student’s records.

Output

How To Make Student Record System Project in C++ | C++ Project

How To Make Student Record System Project in C++ | C++ Project

How To Make Student Record System Project in C++ | C++ Project

Conclusion

We have successfully implemented a Student Record system in c++ project with all the required functionalities. With the help of this management system, it will become very convenient to manage and record student data and can easily retrieve the stored information when required.

 

You May Also Like To Create…

1 Comment

  1. marjorie devanny

    Good day! I could have sworn I’ve been to this site before
    but after reading through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely glad I found it and I’ll be book-marking and checking back frequently!

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *