#include<iostream>
using namespace std;
int main()
{
//1.单精度 float(4个字节)
//2.双精度 double(8个字节)
//3.默认情况下输出一个小数,显示6位有效数字
float f1 = 3.1415926f;//后面加f表示单精度,不加默认为双精度
double f2 = 3.1415926;
cout << "f1=" << f1 << endl;
cout << "f2=" << f2 << endl;
cout << "float占用内存空间为:" << sizeof(float) << "字节" << endl;
cout << "double占用内存空间为:" << sizeof(double) << "字节" << endl;
//科学计数法
float f3 = 3e2; //3*10~2
cout<< "f3 = "<< f3<< endl;
float f4 = 3e-2; //3*10~-2 //3*0.1~2
cout << "f4 = " << f4 << endl;
system("pause");
return 0;
}