#include <iostream>
#include <stdlib.h>
using namespace std;
namespace myNum
int x = 105;
}
int main()
{ bool isOdd=true;
if(myNum::x % 2 == 0)
{ isOdd=false;
}
else
{isOdd=true;
}
if(isOdd)
{cout << "x is Odd"<<endl;
}
else
{ cout << "x is not Odd" <<endl;}
return 0;
}
#include <stdlib.h>
using namespace std;
namespace myNum
int x = 105;
}
int main()
{ bool isOdd=true;
if(myNum::x % 2 == 0)
{ isOdd=false;
}
else
{isOdd=true;
}
if(isOdd)
{cout << "x is Odd"<<endl;
}
else
{ cout << "x is not Odd" <<endl;}
return 0;
}
std::cout << "Hello, World!\n";表示在std命名空间中调用cout,
C++中的函数放在命名空间中。
C++中的函数放在命名空间中。
2017-06-03
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;
}
system("pause");
return 0;
}
{
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;
}
system("pause");
return 0;
}