- 8 bit 比特 = 1 byte 字节
- 变量首字母只能是 下划线 或者 字母,其他为下划线、字母、数字
- 变量不能是关键字
- 命名不要用拼音,不要用单个英文单词
代码如下
int main(){
cout << "数据类型字节数字" << endl;
cout << "char = " << sizeof(char) << endl;
cout << "bool = " << sizeof(bool) << endl;
cout << "int = " << sizeof(int) << endl;
cout << "float = " << sizeof(float) << endl;
cout << "double = " << sizeof(double) << endl;
cout << "long = " << sizeof(long) << endl;
cout << "long long = " << sizeof(long long) << endl;
cout << "ASCII码值" << endl;
char a = 'a', A = 'A', num = '0';
cout << (int)a << endl;
cout << (int)A << endl;
cout << (int)num << endl;
return 0;
}
-
数据类型字节数字
char = 1
bool = 1
int = 4
float = 4
double = 8
long = 8
long long = 8 -
ASCII码值
97
65
48
char,8位,1字节,-128~+127