C++ To implement the student management system

  • 2020-10-23 21:06:24
  • OfStack

The example of this article Shared C++ to achieve the specific code of the student management system for your reference, the specific content is as follows


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream.h>

//  Student information structure 
typedef struct _STRU_STU_SCORE_{
 unsigned int nStuId;
 char cpName[256];
 unsigned short nScoreChinese;
 unsigned short nScoreMath;
 unsigned short nScoreEnglish;
} STRU_STU_SCORE;

void PrintHelp()
{
 cout<<"\n//**************************************************************************//\n";
 cout<<"//*************  learn   raw   into   performance   tube   Richard   Department of   system  *****************//\n";
 cout<<"//**************************************************************************//\n";

 cout<<" ( 1 Insert) 1 Entry record, please enter i or I ; \n ( 2 ) to delete 1 Entry record, please enter d or D ; \n";
 cout<<" ( 3 ) Please enter the modified record m or M ; \n ( 4 ) for record enquiries, please enter g or G ; \n";
 cout<<" ( 5 ) to display all records, please enter a or A ; \n ( 6 ) display failure record, please enter f or F ; \n";
 cout<<" ( 7 ), please enter the help file h or H ; \n ( 8 ) Delete all records, please enter c or C . \n";
 cout<<" ( 9 ) to exit, please enter q or Q . \n";

 cout << flush;

 return;
}

int InsertRecord()
{
 STRU_STU_SCORE e;
 int rslt;

 cout<<"\n Please enter each of the recorded information: \n";

 cout<<"\n Student number: ";
 cin>>e.nStuId;

 cout<<"\n Name: ";
 cin >> e.cpName;

 cout<<"\n Chinese score: ";
 cin >> e.nScoreChinese;

 cout<<"\n Math scores: ";
 cin >> e.nScoreMath;

 cout<<"\n English Score: ";
 cin >> e.nScoreEnglish;

 //  Insert the list 
 //  To call the linked list Insert The operation code 

 rslt = 0; /*  Insert the results  */
 if (rslt == 0)
 {
 cout << endl << " Insert record successful! ";
 }
 else
 {
 cout << endl << "\n Insert record failed! ";
 }

 cout << flush;

 return 0;
}

int QueryAllRecord()
{
 // Print all student achievement information. 
 cout << "\n Print all student achievement information. \n";

 cout << endl;
 cout << endl;
 cout << "\n Student id   The name   Chinese language and literature   mathematics   English \n";

 //  Displays all student information 

 cout << endl;
 cout << endl;

 cout << flush;

 return 0;
}

int QueryRecord()
{
 STRU_STU_SCORE e;

 cout << "\n Please enter the student number for record inquiry: ";
 cin >> e.nStuId;

 cout << endl;
 cout << endl;

 cout << "\n Student id   The name   Chinese language and literature   mathematics   English \n";
 //  Displays the student information 

 cout << endl;
 cout << endl;

 cout << flush;

 return 0;
}

int DelRecord()
{
 unsigned int stuid;

 cout << "\n Please enter the student number to delete the record: ";
 cin >> stuid;

 //  Delete record code 

 return 0;
}

int ModifyRecord()
{
 STRU_STU_SCORE e;

 cout << "\n Please enter each of the recorded information: \n";

 cout << "\n Student number: ";
 cin >> e.nStuId;

 cout << "\n Name: ";
 cin >> e.cpName;

 cout << "\n Chinese score: ";
 cin >> e.nScoreChinese;

 cout << "\n Math scores: ";
 cin >> e.nScoreMath;

 cout << "\n English Score: ";
 cin >> e.nScoreEnglish;

 //  Modification record code 

 return 0;
}

int QueryFailedRecord()
{
 // Print the grades of all failing students. 
 cout << "\n Print all student achievement information. \n";

 cout << endl;
 cout << endl;
 cout << "\n Student id   The name   Chinese language and literature   mathematics   English \n";

 //  The query displays the failed student information code 

 cout << endl;
 cout << endl;
 cout << flush;

 return 0;
}

int main()
{
 char cSelection;

 PrintHelp();

 while (1)
 {
 printf("\n Please enter your choice ( i,d,m,g,a,f,h,c or q ) : ");

 cSelection = getche();
 switch(cSelection)
 {
 case 'i':
 case 'I':
 {
 InsertRecord();
 break;
 }

 case 'd':
 case 'D':
 {
 DelRecord();
 break;
 }

 case 'm':
 case 'M':
 {
 ModifyRecord();
 break;
 }

 case 'g':
 case 'G':
 {
 QueryRecord();
 break;
 }

 case 'a':
 case 'A':
 {
 QueryAllRecord();
 break;
 }

 case 'f':
 case 'F':
 {
 QueryFailedRecord();
 break;
 }

 case 'c':
 case 'C':
 {

// DeleteAll();;
 break;
 }

 case 'q':
 case 'Q':
 {
// DestroyList();;
 break;
 }

 case 'h':
 case 'H':
 {
 PrintHelp();
 break;
 }

 default:
 {
 break;
 }
 }

 if (cSelection == 'q' || cSelection == 'Q')
 {
 break;
 }
 }

 return 0;
}

Recommended articles:

C++ simple library management system

C++ to achieve a simple staff information management system

C++ Basic Student Management system

For more information about the management system, please click "Management system Topics" to learn


Related articles: