Home > Back-end >  C student achievement management system
C student achievement management system

Time:09-17

# include
# include
# include
# include
//# include
//# include
# include
# include
using namespace std;
The class people {
Protected:
Char name [20].
Char sex [5].
Int number;
Public:
People ()
{
Strcpy (name, "");
Strcpy (sex, "");
Number=0;
}
Virtual void num ()=0;
};
The class student: public people
{
Private:
Int score [3].
Int total;
Int business;
Public:
Static int n;
Student (a);
/* void the add ();
Void the output ();
Void the find ();
Void the modify ();
Void does ();
Void the sort ();
Void the save ();
Void the load (); */
Virtual void num () {}
Student & amp; Operator=(const student & amp; T);
Friend cost & amp; Operator> (istream& Scin, student& S1);
Friend ostream & amp; Operator<(ostream& Scout, student& S2);
~ student () {}
The friend of the class the teacher;
};
Int student: : n=0;
The class the teacher: public people {
Private:
String tutor;
Public:
The teacher () : people ()
{
Cout<" * * * * * * * * * * please enter the name of the teacher's: * * * * * * * * * * * "& lt; Cin> Tutor;
getchar();
}
Virtual void num ()
{
Cout<" Phone number: "& lt; Cin> Number;
getchar();
}
Void the add ();
Void the output ();
Void the find ();
Void the modify ();
Void does ();
Void the sort ();
Void the save ();
Void the load ();
~ the teacher () {}
};
Student stu [100].
//int n=0;
Student: : student () : people ()
{
//strcpy (name, "");
//strcpy (sex, "");
For (int I; i<3; I++)
Score [I]=0;
Total=0;
Business=0;
}
Void the teacher: : add ()
{
Char flag='Y'
While (toupper (flag)=='Y')
{
Cin> [student: stu: n];
Student: : n++;
Cout<" To continue to add? (y/n) "& lt; Cin> Flag;
If (toupper (flag)! )
='Y'{
If (toupper (flag)=='N')
break;
The else
{
Cout<" Error, please enter again: "& lt; Cin> Flag;
}
}
}
}
Void the teacher: : the output ()
{
If (student: : n!=0)
Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - "& lt; Cout<" Number \ t "& lt; <" The name \ t "& lt; <" Sex \ t "& lt; <" Math \ t "& lt; <" C + + \ t "& lt; <" English \ t "& lt; <" Total \ t "& lt; <" Business & lt;" Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "& lt; For (int t=0; T{
Cout}
}
Void the teacher: : find ()
{
Int f3=0;
Char n1 [20].
Student temp.
Cout<" Please enter you will find the names of the people: "& lt; Cin> N1.
for(int j=0; j{
If (STRCMP (stu [j]. Name, n1)==0)
{
Temp=stu [j];
F3=1;
}
}
If (f3==0)
Cout<" I'm sorry to find student's result, without you "& lt; The else {
Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "& lt; Cout<" Number \ t "& lt; <" The name \ t "& lt; <" Sex \ t "& lt; <" Math \ t "& lt; <" C + + \ t "& lt; <" English \ t "& lt; <" Total \ t "& lt; <" Business & lt;" Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - "& lt; Cout<" "& lt; for(int i=0; i<3; I++)
{
CoutCout<" \ t ";
}
}
}
Void the teacher: : modify ()
{
Int the f4=0;
Int t;
Char n2 [50];
Cout<" Input you want to modify the names of people: "& lt; Cin> N2.
for(int j=0; j{
If (STRCMP (stu [j]. Name, n2)==0)
{
T=j;
F4=1;
}
}
If (f4==0)
Cout<" I'm sorry, didn't you want to modify student achievement, "& lt; The else
{
Cout<" Please enter the student id: "& lt; Cin> Stu [t]. Number;
Cout<" Name: "& lt; Cin> Stu [t]. Name;
Cout<" Gender: "& lt; Cin> Stu [t]. Sex;
Cout<" Results: higher mathematics "& lt; Cin> Stu [t]. Score [0];
Cout<" C + + grade: "& lt; Cin> Stu [t]. Score [1].
Cout<" English: "& lt; Cin> Stu [t]. Score [2];
Stu [t]. Total=0;
for(int i=0; i<3; I++)
Stu [t]. Total +=stu [t] score [I];
Stu [t]. Business=stu [t]. Total/3;
Cout<" Modify success!" }
}
Void the teacher: : does ()
{
Char n3 [20].
Bool f5=0;
Char c;
Do {
Cout<" Please input you want to delete the names of the students: "& lt; Cin> N3.
for(int i=0; i{
If (STRCMP (n3, stu [I] name)==0)
{
F5=1;
Student: : n -;
Do {
Stu [I]=stu [I + 1);
i++;
} while (i}
}
If (f5==0)
Cout<" You want to delete the object would not have been there!" Cout<" To continue to delete? (y/n) "& lt; Cin> c;
If (toupper (c)!='Y' | | toupper (c)!='N')
{
Cout
  • Related