判断奇、偶数
#include <iostream>
#include <stdlib.h>
using namespace std;
namespace MyNum {
int x = 1;
}
int main()
{
while (1) {
cout << "please enter a number" << endl;
cin >> MyNum::x;
bool isOdd = false;
if (MyNum::x % 2 == 0) {
isOdd = false;
} else {
isOdd = true;
}
if(isOdd == false){
cout<<"x is Odd number"<<endl;
} else {
cout<<"x is Even number"<<endl;
}
}
system("pause");
return 0;
}