Home > Back-end >  InFile> problem
InFile> problem

Time:09-25

Void main ()
{

Ifstream inFile.
Ofstream outFile;
OutFile. Open (" my. Dat ", the ios: : out);//build output file "my dat"
Char univ []="Tsinghua", the name [10].
Int course=2401, number=0;
OutFile & lt; OutFile & lt; InFile. Open (" my. Dat ", the ios: : | in ios: : _Nocreate);//open input file "my dat"
if(! InFile) {
Cerr & lt; <"Can't open my. Dat" & lt; The exit (1);
}
Coutchar c;
InFile & gt;> The name & gt;> C & gt;> Number;
CoutCoutOutFile & lt; <"Name:" & lt; OutFile & lt; <"Number:" & lt; }

Why c display value is 2, number display value is 401

CodePudding user response:

File is 2401, the first 2 c read into the characters, and then read 401 in number
  • Related