using namespace std;
namespace myNum
{int x = 56934528762;
}
int main()
{
bool isFlag ;
if(myNum::x % 2 == 0)
{
isFlag=false;
}
else
{
isFlag=true;}
if(isFlag==0)
{
cout<<"x是偶数";
}
else
{
cout<<"x是奇数";
}
return 0;
}
故意用bool拐了一个弯
namespace myNum
{int x = 56934528762;
}
int main()
{
bool isFlag ;
if(myNum::x % 2 == 0)
{
isFlag=false;
}
else
{
isFlag=true;}
if(isFlag==0)
{
cout<<"x是偶数";
}
else
{
cout<<"x是奇数";
}
return 0;
}
故意用bool拐了一个弯
#include <stdlib.h>
int main(void)
{
system("pause");
return;
}
会提示报错,错误内容如下:
错误 1 error C2561:
“main”: 函数必须返回值
c:\users\吴吉男\desktop\c++\test100\test100\test.cpp
7 1 test100
int main(void)
{
system("pause");
return;
}
会提示报错,错误内容如下:
错误 1 error C2561:
“main”: 函数必须返回值
c:\users\吴吉男\desktop\c++\test100\test100\test.cpp
7 1 test100
2016-08-27
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
system("pause");
return;
}
#include <stdlib.h>
int main(void)
{
system("pause");
return;
}
2016-08-27
int main(int argc, char* argv[])
{
cout << "请输入一个整数" << endl;
int i;
cin >> i;
cout << "八进制:" << oct << i << ",";
cout << "十六进制:" << hex << i << ",";
cout << "十进制:" << i << ",";
cout << "布尔值:" << boolalpha << (bool)i << endl;
cin.get();
cin.get();
return 0;
}
{
cout << "请输入一个整数" << endl;
int i;
cin >> i;
cout << "八进制:" << oct << i << ",";
cout << "十六进制:" << hex << i << ",";
cout << "十进制:" << i << ",";
cout << "布尔值:" << boolalpha << (bool)i << endl;
cin.get();
cin.get();
return 0;
}
2016-08-22