auto 自动推断类型
#include <iostream>
using namespace std;
int main()
{
auto a='a';
cout<<a<<endl;
auto b=100;
cout<<b<<endl;
// auto c;
// 缺点:
auto x = 0.0; // double
double y = 0.0;
auto z = 0; // short
return 0;
}
练习题:
1,让用户输入自己的身高(米),然后把它转换为里面,并输出出来
2,编写一个程序,让用户输入秒,然后把它转换为 多少天多少小时,多少分钟和多少秒显示出来
3,要求用户输入一个班级的男生和女生的数量,并输出女生的比例(百分比)