# include
# include
//# include
//# include
# include
# include
using namespace std;
The class student
{
Private:
Char name [20].
Char sex [5].
Int number;
Int score [3].
Int total;
Int business;
Public:
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 ();
Student & amp; Operator=(student & amp; T);
Friend cost & amp; Operator> (istream& Scin, student& S1);
Friend ostream & amp; Operator<(ostream& Scout, student& S2);
};
Student stu [100].
Int n=0;
Student: : student ()
{
Strcpy (name, "");
Strcpy (sex, "");
Number=0;
For (int I; i<3; I++)
Score [I]=0;
Total=0;
Business=0;
}
Void student: : add ()
{
Char flag='Y'
While (toupper (flag)=='Y')
{
Cin> Stu [n].
N++;
Cout<" To continue to add? (y/n) "& lt;
If (toupper (flag)! )
='Y'{
If (toupper (flag)=='N')
break;
The else
{
Cout<" Error, please enter again: "& lt;
}
}
}
}
Void student: : the output ()
{
If (n!=0)
Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - "& lt;
Cout
}
Void student: : find ()
{
Int f3=0;
Char n1 [20].
Student temp.
Cout<" Please enter you will find the names of the people: "& lt;
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;
Cout<" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "& lt;
{
Temp. Score [I];
Cout<" \ t ";
}
}
}
Void student: : modify ()
{
Int the f4=0;
Int t;
Char n2 [50];
Cout<" Input you want to modify the names of people: "& lt;
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;
{
Cout<" Please enter the student id: "& lt;
Cout<" Name: "& lt;
Cout<" Gender: "& lt;
Cout<" Results: higher mathematics "& lt;
Cout<" C + + grade: "& lt;
Cout<" English: "& lt;
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 student: does ()
{
Char n3 [20].
Bool f5=0;
Char c;
Do {
Cout<" Please input you want to delete the names of the students: "& lt;
for(int i=0; i
If (STRCMP (n3, stu [I] name)==0)
{
F5=1;
N -;
Do {
Stu [I]=stu [I + 1);
i++;
} while (i<=n);
}
}
If (f5==0)
Cout<" You want to delete the object would not have been there!"
If (toupper (c)!='Y' | | toupper (c)!='N')
{
Cout<" Input error! Please enter a Y or N: "& lt;
}
} while (toupper (c)=='Y');
}
Void student: : sort ()
{
Int I, j, k;
Student s3.
for(i=0; i
K=I;
For (j=I + 1; j
If (stu [j] average> Stu [I] business)
K=j;
If (k!=I)
{
S3=stu [I];
Stu [I]=stu [k].
Stu [k]=s3;
}
}
}
Cout<" Sort \ n \ n success! \ n \ n "& lt;
Void student: : save ()
{
Char filename1 [20].
Cout<" Please enter the file name: "& lt;
Ofstream fout (filename1, the ios: : app);
if(! Fout)
Cerr<" File cannot be opened!"
{
for(int i=0; i