Home > Back-end >  Who can help me have a look at code error, C, a great god for help
Who can help me have a look at code error, C, a great god for help

Time:10-06

#include
using namespace std;
#include
#include
#include
The class Information
{
Private:
Int num.//candidate number
Int sum;//total score
String name;//name
Int Chinese;//the language
Int math;//mathematical
Int English;//English
Public:
Void setdown ();//input the first student achievement
Void setdown2 ();//enter the second batch of student achievement
Void score_rank ();//total ordering
Void english_rank ();//English score over 100 points sort
}; Information person [100]; 100//instance object array
Void Information: setdown ()
{
int n;
Cout & lt; <"Please enter school students:" & lt; Cin & gt;> n;

Ofstream outf (" information. TXT ", the ios: : app);//open the file, not the create
if (! Outf)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
Outf & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <"The first result summary table" & lt; Outf & lt; <"Candidate number" & lt; <'\ t' & lt; <"Name" & lt; <'\ t' & lt; <"Chinese" & lt; <'\ t' & lt; <"Mathematics" & lt; <'\ t' & lt; <"English" & lt; <'\ t' & lt; <" Total score "& lt; Outf & lt; <"(composed of eight digit)" & lt; <'\ t' & lt; <" Chinese "& lt; Outf. Close ();//close the file

For (int I=0; I & lt; n; I++)
{
Cout & lt; <"Please enter the student candidate number, name, Chinese, maths, English subjects:" & lt; Cin & gt;> Num & gt;> The name & gt;> Chinese & gt;> Math & gt;> english;
Sum=Chinese, math and English;

Ofstream outf (" information. TXT ", the ios: : app);//open the file, not the create
if (! Outf)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
Outf & lt; Outf. Close ();//close the file

}
}
Void Information: setdown2 ()
{
int n;
Cout & lt; <"Please enter school students:" & lt; Cin & gt;> n;

Ofstream outf (" information2. TXT ", the ios: : app);//open the file, not the create
if (! Outf)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
Outf & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <"The second batch of results summary table" & lt; Outf & lt; <"Candidate number" & lt; <'\ t' & lt; <"Name" & lt; <'\ t' & lt; <"Chinese" & lt; <'\ t' & lt; <"Mathematics" & lt; <'\ t' & lt; <"English" & lt; <'\ t' & lt; <"Total" & lt; Outf & lt; <"(composed of eight digit)" & lt; <'\ t' & lt; <"Chinese" & lt; Outf. Close ();//close the file

For (int I=0; I & lt; n; I++)
{
Cout & lt; <"Please enter the student candidate number, name, Chinese, maths, English subjects:" & lt; Cin & gt;> Num & gt;> The name & gt;> Chinese & gt;> Math & gt;> english;
Sum=Chinese, math and English;

Ofstream outf (" information2. TXT ", the ios: : app);//open the file, not the create
if (! Outf)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
Outf & lt; Outf. Close ();//close the file

}
}
Void Information: score_rank ()
{
Int line=0;
Int line3=0;
Int line2.
Int line_score=0;
Ofstream myfile (" information. TXT ", the ios: : app);//open the file, not the create
if (!//myfile) to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
For (int I=0; I & lt; 100; I++)
{
Line++;
If (myfile. Eof ())
{
break;
}
Else if (line & lt;
=3){
continue;
}
The else
{
Myfile & gt;> The person [I] num & gt;> The person [I] name & gt;> A person [I]. Chinese & gt;> A person [I]. Math & gt;> A person [I]. English & gt;> The person [I] sum;
Line_score + +;
}
}
Myfile. Close ();//close the file

Ofstream myfile6 (" information2. TXT ", the ios: : app);//open the file, not the create
if (! Myfile6)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
For (int I=(line_score + 1); I & lt; 100; I++)
{
Line3 + +;
If (myfile6 eof ())
{
break;
}
Else if (line & lt;
=3){
continue;
}
The else
{
Myfile6 & gt;> The person [I] num & gt;> The person [I] name & gt;> A person [I]. Chinese & gt;> A person [I]. Math & gt;> A person [I]. English & gt;> The person [I] sum;

}
}
Myfile6. Close ();//close the file

Line2=(line_score - 1);
int temp;
For (int o=0; O & lt; Line2. O++)
For (int I=0; I & gt; Line2 -i; I++)
{
If (the person [I] sum & lt; The person [I + 1] sum)
{
Temp=person [I] sum;
Person [I] sum=person [I + 1] sum;
The person [I + 1] sum=temp;
}
}


Ofstream myfile2 (" student. TXT ", the ios: : app);//open the file, not the create
if (! Myfile2)//to determine whether a file open
{
Cout & lt; <"Always open the file \ n" & lt; return;
}
For (int I=0; I & lt; Line2. I++)
{
Myfile2 & lt;