{
int n;//input one-time to input the number of people,
Int b;//the temporary candidate number is assigned to variable b, is used to calculate candidate number is eight digits
Cout & lt; <"Please enter school students:" & lt;
If (_access (" D: \ \ information. TXT ", 0).=0)//to determine whether a file exists, if there is, just write the following
{
Ofstream outf (" D: \ \ 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;
}
Outf & lt; <'\ t' & lt; <'\ t' & lt; <'\ t' & lt; <"The first result summary table" & lt;
}
For (int I=0; I & lt; n; I++)
{
For (;; )//currently playing dead cycle, if the format error will not be able to perform the next step
{
int a=0;//each time to put this value to zero, a new computing candidate number digits
Cout & lt; <"Please enter the student candidate number (8 digits), name, Chinese, maths, English subjects:" & lt;
B=num.
While (b)//in addition to the 10 method to calculate and candidate number digits
{
+;
B=b/10;
}
If (a==8)//it is equal to 8 digits, is executed next
{
break;
}
The else
{
Cout & lt; <"The format is wrong, please input again! \ n "& lt;
}
Sum=Chinese, math and English;//calculate the total score
Ofstream outf;//open the file, in the form of additional, each input information is saved a
Outf. Open (" D: \ \ information. TXT ", the ios: : app);
Outf & lt; <'\ t' & lt;
}
} in the add a show me
CodePudding user response:
O god, how BBS are dead, there is no answer?CodePudding user response:
Enter the hair on their judgment in a negative valueCodePudding user response:
Cin. Getline (temp1, num 1, 0).When the input is to press Enter and end of the input file (Ctrl + Z), then press Enter to stop input,