int main(){
bool isFlag = false;
if(myNum::x % 2 == 0){
isFlag = false;
}else{
isFlag = true;
}
if(isFlag){
cout << "变量" << myNum::x << "是奇数" << endl;
}else
{
cout << "变量" << myNum::x << "是偶数" << endl;
}
return 0;
}
bool isFlag = false;
if(myNum::x % 2 == 0){
isFlag = false;
}else{
isFlag = true;
}
if(isFlag){
cout << "变量" << myNum::x << "是奇数" << endl;
}else
{
cout << "变量" << myNum::x << "是偶数" << endl;
}
return 0;
}
int main()
{
bool isFlag = false;
if(myNum::x % 2 == 0)
{
isFlag = false;
}
else
{
isFlag = true;
}
// 判断状态位的值
if(isFlag)
{
cout<<"变量"<<myNum::x<<"是奇数"<<endl;
}
else
{
cout<<"变量"<<myNum::x<<"是偶数"<<endl;
}
return 0;
}
{
bool isFlag = false;
if(myNum::x % 2 == 0)
{
isFlag = false;
}
else
{
isFlag = true;
}
// 判断状态位的值
if(isFlag)
{
cout<<"变量"<<myNum::x<<"是奇数"<<endl;
}
else
{
cout<<"变量"<<myNum::x<<"是偶数"<<endl;
}
return 0;
}
已采纳回答 / qq_绿U蓝_0
int array[100]; 定义了静态数组array,并未对数组进行初始化 int* array = new int[100]; 分配了长度为100的动态数组array
2017-07-24
#include <iostream>
#include <stdlib.h>
using namespace std;
namespace myNum
{int x = 105;}
int main()
{bool isFlag = false;
bool isOdd = true;
if(myNum::x % 2 == 0)
cout<<false<<endl;
else
cout<<true<<endl;
if(isOdd)
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;
bool isOdd = true;
if(myNum::x % 2 == 0)
cout<<false<<endl;
else
cout<<true<<endl;
if(isOdd)
cout<<"变量x是奇数"<<endl;
else
cout<<"变量x是偶数"<<endl;
return 0;}