int main() {
int num;
cout << "Enter a number: ";
cin >> num;
cout << "you entered ";
cout << num;
cout << endl;
return 0;
}
程序如何知道用户输入奇数的时候?如何提示用户输入号码,直到他们选择一个奇数? C++
对于“如果声明” ......我不能说如果(NUM ==奇){COUT < <“全部完成”
可能的重复[如何检查整数是偶数还是奇数?](http://stackoverflow.com/questions/160930/how-do-i-check-if-an-integer-is-ven - 或 - 奇) – mech
您需要查看循环。 Do-while循环可能是您要查找的内容。在“num%2!= 0”时做“提示” –