从文本文件中读取,直到EOF重复最后一行
代码:
#include <iostream>#include <fstream>using namespace std;int main(){
ifstream iFile("input.txt"); // input.txt has integers, one per line
while (!iFile.eof())
{
int x;
iFile >> x;
cerr << x << endl;
}
return 0;}输入txt:
10 20 30
输出量:
10 20 30 30
注
Helenr
慕仙森
POPMUISE
慕码人2483693
随时随地看视频慕课网APP
相关分类