1.txt文件内容如下:
50 2024 3.16 I
love
GESP!
对应C++代码如下:
int main()
{
ifstream fin;
string line;
int x;
fin.open("1.txt", ios::in);
for (int i = 0; i < 2; i++) {
fin >> line;
cout << line << endl;
}
fin >> x;
cout << x << endl; //####
cout << endl;
return 0;
}