# include & ltcstring & gt
# include & ltiomanip & gt
# include & ltwindows.h & gt
Use namespace std
//Declare abstract class Person class
Class personage
{
Public:
person(){ };
~ Person(){ };
Virtual void set person () = 0; //pure virtual function input information
Virtual void getperson () = 0; //pure virtual function output information
};
//declare student information class
Classstudent: public person//public inheritance
{
Public:
Student () {};
~ Student(){ };
void set number(int num){ number = num; }
void set name(char * n){ strcpy(name,n); }
void set grade(char * g){ strcpy(grade,g); }
int get number(){ return number; }
char * getname(){ return name; }
char * get grade(){ return grade; }
Void setstudent() // input function
{
Cout & lt& lt "Please enter your student number:";
CIN & gt; & gt number;
Cout & lt& lt "Please enter the student name:";
CIN & gt; & gt name;
Cout & lt& lt "Please enter the student's class:";
CIN & gt; & gt grade;
}
Private:
char name[20]; //Name of student
Char grade [20]; //Students' classes
Int number; //student ID
};
//Declare achievement class
Class score
{
Public:
score(){ };
~ Score(){ };
void set English(float E){ English = E; }
void setmath(float M){ math = M; }
void set physics(float P){ physics = P; }
void set sports(float S){ sports = S; }
void set computer(float C){ computer = C; }
float get English(){ return English; }
float get math(){ return math; }
float get physics(){ return physics; }
Floating-point getsports () {returnsports; }
float get computer(){ return computer; }
Void setscore() // Input function
{
Cout & lt& lt "Please enter your English score:";
CIN & gt; & gt English;
Cout & lt& lt "Please enter your math score:";
CIN & gt; & gt Mathematics;
Cout & lt& lt "Please enter a physical score:";
CIN & gt; & gt physics;
Cout & lt& lt "Please enter sports scores:" ";
CIN & gt; & gt Sports;
Cout & lt& lt "Please enter a C++ score:";
CIN & gt; & gt computer;
}
Floating total (); //Calculate the credit score
Private:
Floating English;
Floating-point mathematics;
Floating physics;
Float movement;
Floating-point computer;
};
Floating Score:: Total ()
{Fuzong;
Zong = English * 2+ Mathematics * 4+ Physics * 4+ Physical Education * 1+ Computer * 3;
Return to Zong/14.0;
}
//Information class that declares students' grades.
Class stuscore: public student, public score//multiple inheritance
{
Public:
stu score(){ };
~ stu score(){ };
void setstusscore(); //Enter student achievement information
void printf 1(){ cout & lt; & lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget English(); }
void print F2(){ cout & lt; & lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget math(); }
void print F3(){ cout & lt; & lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget physics(); }
void print 4(){ cout & lt; & lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget sports(); }
void print F5(){ cout & lt; & lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget computer(); }
Invalid printing ()
{
cout & lt& lt" " " & lt& ltget number()& lt; & lt" " " & lt& ltgetname()& lt; & lt" " " & lt& ltget English()& lt; & lt" " " & lt& ltgetmath()& lt; & lt" " " & lt& ltget physics()& lt; & lt" " " & lt& ltget sports()& lt; & lt" " " & lt& ltget computer()& lt; & ltendl
}
};
Void stu score::setstu score()// defines the input function.
{
set student();
setscore();
}
void menu();
int func 1(stu score stu SCO[]);
void func2(stuscore stusco[],int m);
void func3(stuscore stusco[],int m);
void func4(stuscore stusco[],int m);
void func5(stuscore stusco[],int m);
int I =- 1;
int f;
Int number;
char name[20];
Floating English;
Floating-point mathematics;
Floating physics;
Float movement;
Floating-point computer;
//main function
void main()
{
stu score stu SCO[20];
int n;
menu();
Cout & lt& lt "Please enter a number between 1~7"
Cout & lt& lt "Please enter a menu option:";
CIN & gt; & gtn;
while( 1)
{
Switch (n)
{
case 1:f = func 1(stus co); Break;
Case 2: func2(stusco, F); Break;
Case 3: func3(stusco, F); Break;
Case 4: func4(stusco, F); Break;
Case 5: func5(stusco, F); Break;
Case 7: Export (0);
}
}
}
//Main menu function
Invalid menu ()
{
System ("color d");
Cout & lt& lt "Welcome to the student achievement management system!" & lt& ltendl
cout & lt& lt“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *”& lt; & ltendl
Cout & lt& lt"- Student Achievement Management System "
cout & lt& lt“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *”& lt; & ltendl
Cout & lt& lt"* 1. Student scores entry * "
Cout & lt& lt"* 2. Inquiry about students' grades * "
Cout & lt& lt"* 3. Revision of students' grades * "<& ltendl
Cout & lt& lt"* 4. Query all students' single subject scores * "
Cout & lt& lt"* 5. Single subject score statistics * "
Cout & lt& lt" * (the average grade and the ratio between grades) * "
Cout & lt& lt"* 6. Student's total score ranking * "<& ltendl
Cout & lt& lt"* 7. Exit the system * "
cout & lt& ltendl
}
//Enter the performance function
int func 1(stu score stusco[])
{ char p;
Do {
i++;
Stusko [i]. setstusscore();
Cout & lt& lt "Input successful!" ;
Cout & lt& lt "Do you want to continue typing (press Y to continue typing, press N to exit):"
CIN & gt; & gtp;
} while(p = = ' y ');
Returns I+1;
}
//Query performance function
void func2(stuscore stusco[])
{
int k;
Cout & lt& lt"-[ 1] Query by name-"
Cout & lt& lt"- [2] Query by Student ID-"
Cout & lt& lt Please enter a query method (1 or 2):;
CIN & gt; & gtk;
If (k== 1)
{
char n = ' y
int u[ 10];
while(n=='y ')
{
int j = 0;
Cout & lt& lt "Please enter the name of the student to query:";
CIN & gt; & gt name;
int t = 0;
for(; t & ltf; t++)
if(strcmp(name,stusco[t].getname())==0)
{ u[j]= t;
j++;
}
If (j==0)
{cout & lt& lt "There is no student name you want to query!" ; //Not found
Cout & lt& lt "Do you want to quit? Please press n "
CIN & gt; & gtn;
}
for(int b = 0; b & ltj; b++)
{
if(j & lt; 2)
{
t = u[b];
Cout & lt& lt "student number" << "name"
Cout & lt& lt" ""<& lt Stusko [t]. get number()& lt; & lt" ""<& lt Stusko [t]. getname()& lt; & lt" ""<& lt Stusko [t]. get English()& lt; & lt" ""<& lt Stusko [t]. getmath()
& lt& lt" ""<& lt Stusko [t]. get physics()& lt; & lt" ""<& lt Stusko [t]. get sports()& lt; & lt" ""<& lt Stusko [t]. get computer()& lt; & lt" ""<& lt Stusko [t]. total()& lt; & ltendl
Cout & lt& lt "Do you want to continue the query (press Y to continue, press N to exit)?"
CIN & gt; & gtn;
}
other
{
t = u[b];
}
}
}
}
If (k==2)
{
char n = ' y
while(n=='y ')
{
int j = 0;
Cout & lt& lt "Please enter the student ID of the student to be queried:";
CIN & gt; & gt number;
int t = 0;
for(; t & ltf; t++)
{
if(number==stusco[t]。 getnumber())
{
Cout & lt& lt "student number" << "name"
Cout & lt& lt" ""<& lt Stusko [t]. get number()& lt; & lt" ""<& lt Stusko [t]. getname()& lt; & lt" ""<& lt Stusko [t]. get English()& lt; & lt" ""<& lt Stusko [t]. getmath()
& lt& lt" ""<& lt Stusko [t]. get physics()& lt; & lt" ""<& lt Stusko [t]. get sports()& lt; & lt" ""<& lt Stusko [t]. get computer()& lt; & lt" ""<& lt Stusko [t]. total()& lt; & ltendl
Cout & lt& lt "Do you want to continue the query (press Y to continue, press N to exit)?"
CIN & gt; & gtn;
}
other
{cout & lt& lt "There are no students you want to query!" ;
Cout & lt& lt "Do you want to quit? Please press n "
CIN & gt; & gtn;
}
}
}
}
}
//Modify the information function
void func3(stuscore stusco[],int m)
{
int j=0,b[20],r;
Int mark;
char n = ' y
while(n=='y ')
{
Cout & lt& lt "Please enter the student ID of the student whose grade you want to modify:";
CIN & gt; & gt number;
flag = 0;
int d;
for(int t = 0; t & ltm; t++)
if(number==stusco[t]。 getnumber())
Do {
b[j]= t;
Cout & lt& lt "Please select the information to modify:"
Cout & lt& lt" 1. Revise English scores "
Cout & lt& lt"2. Revise math scores "
Cout & lt& lt"3. Modify the physical score "
Cout & lt& lt"4. Revise sports scores "
Cout & lt& lt"5. Modify the C++ score "
Cout & lt& lt Please choose a number between 1~5:;
CIN & gt; & gtd;
If (d== 1)
{
Cout & lt& lt "Please enter a new English score:";
CIN & gt; & gt English;
Stusko [t]. Setenglish (English);
}
else if(d==2)
{
Cout & lt& lt "Please enter a new math score:";
CIN & gt; & gt Mathematics;
Stusko [t]. Setmath (mathematics);
}
else if(d==3)
{
Cout & lt& lt "Please enter a new physics score:";
CIN & gt; & gt physics;
Stusko [t]. Setphysics (physics);
}
else if(d==4)
{
Cout & lt& lt "Please enter a new sports score:";
CIN & gt; & gt Sports;
Stusko [t]. Setsports;
}
else if(d==5)
{
Cout & lt& lt Please enter a new C++ level:;
CIN & gt; & gt computer;
Stusko [t]. Setcomputer (computer);
}
flag = 1;
j++;
} while(d & lt; 1 | | d & gt; 5);
If (flag ==0)
{
Cout & lt& lt "There is no student you are looking for!" & lt& ltendl
Cout & lt& lt "Please re-enter (press N to exit)";
CIN & gt; & gtn;
}
other
{
Cout & lt& lt "Do you want to continue modifying (press Y to continue, press N to exit):";
CIN & gt; & gtn;
}
}
Cout & lt& lt "Revised student scores:"
Cout & lt& lt "Student Name English Mathematics Physics Sports C++"
for(int t = 0; t & ltj; t++)
{
r = b[t];
Stusko [r]. print();
}
}
//Query all students' single subject scores.
void func4(stuscore stusco[],int m)
{
int k;
char n = ' y
while(n=='y ')
{
Cout & lt& lt" 1. English "
Cout & lt& lt"2. Mathematics "
Cout & lt& lt"3. Physics "
Cout & lt& lt"4. Sports "
cout & lt& lt"5.c++ " & lt; & ltendl
cout & lt& ltendl
Cout & lt& lt Please enter a number between 1~5 to select the topic to query: ";
CIN & gt; & gtk;
If (k== 1)
{
for(int t = 0; t & ltm; t++)
stus co[t]. printf 1();
}
else if(k==2)
{
for(int t = 0; t & ltm; t++)
stus co[t]. print F2();
}
else if(k==3)
{
for(int t = 0; t & ltm; t++)
stus co[t]. print F3();
}
else if(k==4)
{
for(int t = 0; t & ltm; t++)
stus co[t]. prinft 4();
}
else if(k==5)
{
for(int t = 0; t & ltm; t++)
stus co[t]. print F5();
}
Cout & lt& lt "Do you want to continue the query? (Please press Y to continue and N to exit): ";
CIN & gt; & gtn;
}
}
void func5(stuscore stusco[],int m)
{
int k;
Floating and excellent;
Float well;
Floating pass;
Floating failed;
int exc=0,wel=0,pas=0,fai = 0;
Cout & lt& lt" 1. English "
Cout & lt& lt"2. Mathematics "
Cout & lt& lt"3. Physics "
Cout & lt& lt"4. Sports "
cout & lt& lt"5.c++ " & lt; & ltendl
cout & lt& ltendl
Cout & lt& lt "Please enter a number between 1~5 to select the topic to be counted:";
CIN & gt; & gtk;
If (k== 1)
{
for(int t = 0; t & ltm; t++)
{if(stusco[t])。 get English()& gt; = 85)++ exc;
else if(stusco[t].get English()& gt; = 70)++ wel;
else if(stusco[t].get English()& gt; = 60)++ pas;
else if(stusco[t].get English()& lt; 60)++ fai;
}
Excellent = exc/m;
Well = wel/m;
Pass = Pass/meter;
fail = fai/m;
Cout & lt& lt "The statistical result of English scores is"
Cout & lt& lt "preferential price:"
Cout & lt& lt "favorable rate:"
Cout & lt& lt "Pass rate:"
Cout & lt& lt "Failure rate:"
}
else if(k==2)
{
for(int t = 0; t & ltm; t++)
{if(stusco[t])。 getmath()& gt; = 85)++ exc;
else if(stusco[t].getmath()& gt; = 70)++ wel;
else if(stusco[t].getmath()& gt; = 60)++ pas;
else if(stusco[t].getmath()& lt; 60)++ fai;
}
Excellent = exc/m;
Well = wel/m;
Pass = Pass/meter;
fail = fai/m;
Cout & lt& lt "The statistical result of math scores is"
Cout & lt& lt "preferential price:"
Cout & lt& lt "favorable rate:"
Cout & lt& lt "Pass rate:"
Cout & lt& lt "Failure rate:"
}
else if(k==3)
{
for(int t = 0; t & ltm; t++)
{if(stuscco[t])。 get physics()& gt; = 85)++ exc;
else if(stusco[t].get physics()& gt; = 70)++ wel;
else if(stusco[t].get physics()& gt; = 60)++ pas;
else if(stusco[t].get physics()& lt; 60)++ fai;
}
Excellent = exc/m;
Well = wel/m;
Pass = Pass/meter;
fail = fai/m;
Cout & lt& lt "The statistical result of physics scores is"
Cout & lt& lt "preferential price:"
Cout & lt& lt "favorable rate:"
Cout & lt& lt "Pass rate:"
Cout & lt& lt "Failure rate:"
}
else if(k==4)
{
for(int t = 0; t & ltm; t++)
{if(stuscco[t])。 get sports()& gt; = 85)++ exc;
else if(stusco[t].get sports()& gt; = 70)++ wel;
else if(stusco[t].get sports()& gt; = 60)++ pas;
else if(stusco[t].get sports()& lt; 60)++ fai;
}
Excellent = exc/m;
Well = wel/m;
Pass = Pass/meter;
fail = fai/m;
Cout & lt& lt "The statistical results of sports achievements are"
Cout & lt& lt "preferential price:"
Cout & lt& lt "favorable rate:"
Cout & lt& lt "Pass rate:"
Cout & lt& lt "Failure rate:"
}
else if(k==5)
{
for(int t = 0; t & ltm; t++)
{if(stuscco[t])。 get computer()& gt; = 85)++ exc;
else if(stusco[t].get computer()& gt; = 70)++ wel;
else if(stusco[t].get computer()& gt; = 60)++ pas;
else if(stusco[t].get computer()& lt; 60)++ fai;
}
Excellent = exc/m;
Well = wel/m;
Pass = Pass/meter;
fail = fai/m;
Cout & lt< "The statistical result of C++is"
Cout & lt& lt "preferential price:"
Cout & lt& lt "favorable rate:"
Cout & lt& lt "Pass rate:"
Cout & lt& lt "Failure rate:"
}
}