Void input ()//cin the student information
{
Void input1 ();
If (d==0)//the first time
{
for(i=1; i<=n; I++)
Input1 ();
Printf (" \ n OK, it is done. \ n \ n ");
}
Else if (d==1)//add the information
{
For (I=n + 1; i<=n + flag; I++)
Input1 ();
}
N=n + flag;
Printf (" \ n OK, it is done. I will return \ n \ n ");
}
Void input1 ()
{
The FILE * fp.
Fp=fopen (" D: \ \ CC \ \ grades. TXT ", "r");
If (fp==NULL)
{
Printf (" always find the file!!!!!! \n");
exit(0);
}
while(! The feof (fp))
{
Printf (" do cin number % d 's information: \ n ", I);
Printf (" the school number: \ t ");
for(int k=0; k{
The fscanf (fp, "% s", & amp; Grades [I] num);
If (grades [I] num<=0)
{
Printf (" Error! Both Please check it again \ n ");
The fscanf (fp, "% s", & amp; Grades [I] num);
}
}
for(j=1; j{
If (STRCMP (grades [I] num, grades [j]. Journal of num)==0)
{
Printf (" the two are same Try it again ");
The fscanf (fp, "% s", & amp; Grades [I] num);
break;
}
}
Name: printf (" \ t ");
The fscanf (fp, "% s", & amp; Grades [I] name);
For a boy with a printf (" the sex 1 and 0 for a girl: ");
The fscanf (fp, "% d", & amp; Grades [I] sex);
If (grades [I] sex!=1 & amp; & Grades [I] sex!
=2){
Printf (" We don 't have a shemale, try it again ");
The fscanf (fp, "% d", & amp; Grades [I] sex);
}
Printf (" the height: \ t ");
The fscanf (fp, "% f", & amp; Grades [I]. Height);
If (grades [I] height<=40 | | grades [I] height>
=250){
Printf (" The data maybe wrong, both please try it again ");
The fscanf (fp, "% f", & amp; Grades [I]. Height);
}
Printf (" the weight: \ t ");
The fscanf (fp, "% f", & amp; Grades [I]. Weight);
If (grades [I] weight<=40 | | grades [I] weight>
=300){
Printf (" The data maybe wrong, both please try it again ");
The fscanf (fp, "% f", & amp; Grades [I]. Weight);
}
Printf (FCV: \ "t");
The fscanf (fp, "% d", & amp; Grades [I] FCV);
If (grades [I] FCV<=300 | | grades [I] FCV>
=9000){
Printf (" The data maybe wrong, both please try it again ");
The fscanf (fp, "% d", & amp; Grades [I] FCV);
}
Printf (" UPS or WAKES: \ t ");
The fscanf (fp, "% d", & amp; Grades [I]. Count);
If (grades [I] count<0 | | grades [I] count>
=65){
Printf (" The data maybe wrong, both please try it again ");
The fscanf (fp, "% d", & amp; Grades [I]. Count);
}
If (grades [I] sex==1) {
If (grades [I] FCV> 4800) {
Grades [I] sco1=100;
} else if (grades [I] FCV> 4180) {
Grades [I] sco1=80;
} else if (grades [I] FCV> 3100) {
Grades [I] sco1=60;
} the else grades [I] sco1=30;
If (grades [I] count> 19) {
Grades [I] sco2=100;
} else if (grades [I] count> 15) {
Grades [I] sco2=80;
} else if (grades [I] count> 9) {
Grades [I] sco2=60;
} the else grades [I] sco2=30;
} else if (grades [I] sex==2) {
If (grades [I] FCV> {
=3400)Grades [I] sco1=100;
} else if (grades [I] FCV> 3000) {
Grades [I] sco1=80;
} else if (grades [I] FCV> 2050) {
Grades [I] sco1=60;
} the else grades [I] sco1=30;
If (grades [I] count> 56) {
Grades [I] sco2=100;
} else if (grades [I] count> 52) {
Grades [I] sco2=80;
} else if (grades [I] count> 24) {
Grades [I] sco2=60;
} the else grades [I] sco2=30;
}
Grades [I]. BMI=grades [I] weight/(grades [I] height * grades [I] height);
If (grades [I] BMI>=17.9 & amp; & Grades [I] BMI<{
=23.9)Grades [I] sco3=100;
} else if (grades [I] BMI<17.9) {
Grades [I] sco3=80;
} else if (grades [I] BMI>=24.0 & amp; & Grades [I] BMI<{
=27.9)Grades [I] sco3=80;
} else if (grades [I] FCV> 27.9)
Grades [I] sco3=60;
Grades [I] scoALL=0.25 * grades [I] sco3 + 0.35 * grades [I] sco1 + 0.40 * grades [I] sco2;
If (grades [I] scoALL>
=95){
Strcpy (grades [I] level, "excellent");
}
Else if (grades [I] scoALL>
=80){
Strcpy (grades [I] level, "good");
}
Else if (grades [I] scoALL>=60)
{
Strcpy (grades [I] level, "pass");
}
The else strcpy (grades [I] level, "fail");
}
The fclose (fp);
}
Void the save ()//save the information
{
The FILE * fp.
If ((fp=fopen (" student. TXT ", "w"))==NULL)//open the TXT
{
Printf (" the file always open a \ n ");
exit(1);
}
int i=0;
While (I & lt; N)
{
i++;
If (I & lt; N)
Fprintf (fp, "\ n");
}
The fclose (fp);
}

