关于while循环的一点疑问
#include<iostream> 这里我想用while循环统计下输入的字符串个数,请问如何退出while循环呢?谢谢。using namespace std;
int main()
{
string s;
int i=1;
while(cin>>s)
{
cout<<"hello"<<endl;
i++;
}
cout<<i<<endl;
return 0;
}
2013-10-04 05:15
2013-10-04 07:04
2013-10-04 07:10
2013-10-04 12:36
2013-10-06 08:07
2013-10-06 08:27
2013-10-06 09:22
2013-10-09 04:33
2013-10-09 08:30