这是我的代码:
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main() {
string line;
ifstream inputFile;
inputFile.open("input.txt");
do {
getline(inputFile, line);
cout << line << endl;
} while (line != "0");
return 0;
}
input.txt 内容:
5 9 2 9 3
8 2 8 2 1
0
在 Enclipse 中,它进入了无限循环。我正在使用 MinGW 5.1.6 + Eclipse CDT。
我尝试了很多东西,但我找不到问题所在。