#include <iostream>
#include <stdlib.h>
using namespace std;
namespace myNum{int x = 105;}
int main()
{bool isFlag = false;
if(myNum::x % 2 == 0){isFlag=0;}
else{isFlag=0;}
if(isFlag=1){cout<<"x是奇数"<<endl;}
else{cout<<"偶数"<<endl;}
return 0;
}
bool型应该是0代表false,1代表true.
#include <stdlib.h>
using namespace std;
namespace myNum{int x = 105;}
int main()
{bool isFlag = false;
if(myNum::x % 2 == 0){isFlag=0;}
else{isFlag=0;}
if(isFlag=1){cout<<"x是奇数"<<endl;}
else{cout<<"偶数"<<endl;}
return 0;
}
bool型应该是0代表false,1代表true.
#include <iostream>
using namespace std;
int main()
{
int x=9;
cout<<oct<<x<<endl;// oct 8进制
cout<<dec<<x<<endl;/// dec 10进制
cout<<hex<<x<<endl;// hex 16进制
system("pause");
return 0;
}
using namespace std;
int main()
{
int x=9;
cout<<oct<<x<<endl;// oct 8进制
cout<<dec<<x<<endl;/// dec 10进制
cout<<hex<<x<<endl;// hex 16进制
system("pause");
return 0;
}
2016-04-30
#include <iostream>
#include <stdlib.h>
using namespace std;
namespace myNum
{
int x = 105;
}
int main()
{
bool isFlag = false;
if(myNum::x % 2 == 0)
{
isFlag=false;
}else
{isFlag=true;
}
if(isFlag)
{
cout<<"x是奇数"<<endl;
}else
{cout<<"x是偶数"<<endl;
#include <stdlib.h>
using namespace std;
namespace myNum
{
int x = 105;
}
int main()
{
bool isFlag = false;
if(myNum::x % 2 == 0)
{
isFlag=false;
}else
{isFlag=true;
}
if(isFlag)
{
cout<<"x是奇数"<<endl;
}else
{cout<<"x是偶数"<<endl;