大家看看下面一段程序
为什么输入整数的时候运行正常,如果输入非整数就会连续不断的输出* * wrong * *
// 3_1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream.h"
int main(int argc, char* argv[])
{
int c=1;
int magic=123;
int guess;
while(c)
{
cin>>guess;
if(guess==magic)
{cout<<"* * right * *"<<endl;
c=0;}
else
cout<<"* * wrong * *"<<endl;
}
return 0;
}