挺久前的一个问题了,因为刚刚才开博客,就作为我的第一篇文章好了,毕竟也是自己摸索出来的(感谢学长给我指明方向)
#include
using namespace std;
int main()
{
int m = 0, n = 0;
do
{
while (cin >> m >> n)
{
if (m >= 1 && m <= 10 && n >= 1 && n <= 10)
break;
else
{
cout << "Please input the number in range of 1 to 10!\n";
cout << "Input two number: ";
}
}
int c;
while ((c = getchar()) != '\n' && c != EOF);
if (m == 0 || n == 0)
{
cout << "Please input number!\n";
cout << "Input two number: ";
}
} while (m == 0 || n == 0);
return 0;
}