本文共 683 字,大约阅读时间需要 2 分钟。
#include#include #include # define c 100using namespace std;int main(){ //整型输入 int a = 0; cout << "请输入整型变量:" << endl; cin >> a; cout << a << "\tsize:" << sizeof(a) << endl; //浮点型输入 double d = 0; cout << "请输入浮点型变量:" << endl; cin >> d; cout << d << "\tsize:" << sizeof(d) << endl; //字符型输入 char ch = 0; cout << "请输入字符型变量:" << endl; cin >> ch; cout << ch << "\tsize:" << sizeof(ch) << endl; //字符串型输入 string str; cout << "请输入字符串型变量:" << endl; cin >> str; cout << str << "\tsize:" << sizeof(str) << endl; //布尔类型输入 bool flag = true; cout << "请输入布尔型变量:" << endl; cin >> flag; cout << flag << "\tsize:" << sizeof(ch) << endl; system("pause"); return EXIT_SUCCESS;}
转载地址:http://buagj.baihongyu.com/