基本类型

类型初始化

using namespace std;

//常量用 const 加类型名或 auto;
//变量用类型名或 auto

//整数
int number = 42, otherNumber = 37;
const unsigned long maxInt64 = ULONG_MAX;
const int Mb(1048576); 

//双精度浮点数
const auto exp = 2.71828;
double billion = 1E+9;

//单精度浮点数
const float pi = 3.14;

//字符串
const std::string greeting = "Hello";

//多行字符串
std::string text = "this is some\n"
"multiline text";

//布尔值
const bool sunIsStar = true;
auto needBackUp = false;

//字符 "A"
char charA = 'A'; //65, 0x41, '\x41'

cout << "number is " << number << "\n";
cout << "otherNumber is " << otherNumber << "\n";
cout << "maxInt64 is " << maxInt64 << "\n";
cout << "Mb is " << Mb << "\n";
cout << "exp is " << exp << "\n";
cout << "billion is " << billion << "\n";
cout << "pi is " << pi << "\n";
cout << "greeting is " << greeting << "\n";
cout << "text is '" << text << "'\n";
cout << "sunIsStar is " << sunIsStar << "\n";
cout << "needBackUp is " << needBackUp << "\n";
cout << "charA is " << charA;