while(cin>>word)在vc6中怎样结束循环?
这是c++primer第一章的一个程序:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string word;
while ( cin >> word )//vc6不能通过^z结束循环
cout << "word read is: " << word << '\n';
cout << "ok: no more words to read: bye!\n";
return 0;
}
再vc6和dev-c++中均编译通过。
在dev生成的exe文件可以通过ctr-z结束循环,vc6生成的就不能结束循环。请问为什么这样?