积极答复者
输入流

问题
答案
-
导致整个原因是因为您在cin>>a;的时候,输入的是erty55,而a是int类型,这样导致cin输入流的状态被破坏,所以后面的输入操作都不正确。您可以在cin>>a之后加上cin.good()来判断一下返回值是true还是false。
if(!cin.good()) break;
如果您将您的第一个输入修改成55erty,应该就没有问题了。Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Shu 2017 2015年1月8日 2:36
全部回复
-
导致整个原因是因为您在cin>>a;的时候,输入的是erty55,而a是int类型,这样导致cin输入流的状态被破坏,所以后面的输入操作都不正确。您可以在cin>>a之后加上cin.good()来判断一下返回值是true还是false。
if(!cin.good()) break;
如果您将您的第一个输入修改成55erty,应该就没有问题了。Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Shu 2017 2015年1月8日 2:36
-
设断点F11调试进去,这样你可能知道发生了什么。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.