# 2.3实型,浮点型
#include <iostream>
using namespace std;
/*
float 4字节 7位有效数字
double 8字节 15-16位有效数字
*/
int main()
{
//1.单精度float
//2.双精度double
float f1 = 3.14f;//用f表示单精度
cout << "f1:" << f1 << endl;
cout << sizeof(float) << endl;
//科学计数法
float f2 = 3e2;//3*10^2
float f3 = 3e-2;//3*10^-2
system("pause");
return 0;
}
#
#include <iostream>
using namespace std;
/*字符型
char ch='a';
只能是单引号,单引号中只能有一个字符
*/
int main()
{
char ch = 'a';
cout << ch<<endl;
cout << sizeof(char) << endl;
cout << (int)ch << endl;//ascll值
cout << (int)'c' << endl;
system("pause");
return 0;
}
2.4字符型