while((a<=0||a>=10)||(b<=0||b>=10))
{
fflush(stdin);
cout<<"Please input a and b"<<endl;
scanf("%d %d",&a,&b);
}
要先清除输入流哦!!
好像这个做法不好:https://my.oschina.net/deanzhao/blog/79790
原文:http://www.cnblogs.com/gaoxianzhi/p/6536249.html