#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==1)
{ cout << "x是奇数" <<endl;}
else
{cout <<"x是偶数" <<endl;}
return 0;
}
#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==1)
{ cout << "x是奇数" <<endl;}
else
{cout <<"x是偶数" <<endl;}
return 0;
}
请输入一个整数,并将其以八、十、十六进制输出
#include<iostream>
#include<stdlib>
using namespace std;
int main()
{
cout<<"请输入一个整数:”<<endl;
int x;
cin>>x;
cout<<oct<<x<<endl;
cout<<dec<<x<<endl;
cout<<hex<<x<<endl;
cout<<“请输入一个布尔值(0、1):”endl;
bool y=false;
cin>>y;
cout<<boolalpha<<endl;
systerm("pause");
return 0;
}
#include<iostream>
#include<stdlib>
using namespace std;
int main()
{
cout<<"请输入一个整数:”<<endl;
int x;
cin>>x;
cout<<oct<<x<<endl;
cout<<dec<<x<<endl;
cout<<hex<<x<<endl;
cout<<“请输入一个布尔值(0、1):”endl;
bool y=false;
cin>>y;
cout<<boolalpha<<endl;
systerm("pause");
return 0;
}
2016-09-20
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=true)
{
cout<<"变量x是奇数"<<endl;
}
else
{
cout<<"变量x是偶数"<<endl;
}
return 0;
}
namespace myNum
{
int x = 105;
}
int main()
{
bool isFlag = false;
if(myNum::x % 2 == 0)
{
isFlag=false;
}
else
{
isFlag=true;
}
// 判断状态位的值
if(isFlag=true)
{
cout<<"变量x是奇数"<<endl;
}
else
{
cout<<"变量x是偶数"<<endl;
}
return 0;
}