#include<iostream>
using namespace std;
#include<string>//在用c++风格字符串时候,要包含的头文件
int main()
{
//可以用sizeof求出数据类型占用内存大小
//: sizeof(数据类型、变量)
short a = 10;
cout << "short占用内存空间为:" << sizeof(a) << endl;
int b = 10;
cout << "int占用内存空间为:" << sizeof(b) << endl;
long c = 10;
cout << "long占用内存空间为:" << sizeof(c) << endl;
long long d = 10;
cout << "long long占用内存空间为:" << sizeof(d) << endl;
//单精度 float
//双精度 double
float f = 3.14;
cout << "f=" << f << endl;
cout << "float占用内存空间为:" << sizeof(f) << endl;
double g = 3.14;
cout << "g=" << g << endl;
cout << "float占用内存空间为:" << sizeof(g) << endl;
char ch = 'a';
cout << ch << endl;
//1、C风格字符串
//char 字符串名[]
//等号 后面要用“”包含起字符串
char str[] = "hello world";
cout << str << endl;
//2、C++风格字符串
//包含一个头文件 #include<string>
string str2 = "hello world";
cout << str2 << endl;
system("pause");
return 0;
}