while (cin >> str) 无法结束?

cy8864 2001-12-12 08:49:32
vc 6.0

while (cin >> str)

无法结束

如何解决?
...全文
100 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Gallen 2001-12-13
  • 打赏
  • 举报
回复
string str;
while(cin>>str)
{
if(str == "end")
break;
}
Gallen 2001-12-13
  • 打赏
  • 举报
回复
string str;

while(cin>>str)
{
if(str == "end")
break;

}
shornmao 2001-12-13
  • 打赏
  • 举报
回复
在linux下用ctrl+d,在dos/windows下用ctrl+z。
他的意思是读到EOF为止,看看不同的操作系统用什么按键输入EOF。
陈硕 2001-12-13
  • 打赏
  • 举报
回复
ctrl + D
plusplus 2001-12-12
  • 打赏
  • 举报
回复
cin>>str is OK.
because cin >> str returns cin, so,
while (cin >> str) will not return;

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧