This commit is contained in:
2026-02-24 07:39:30 +08:00
parent fae2ab8977
commit 397c928058
2 changed files with 22 additions and 0 deletions

22
实型数据类型.cpp Normal file
View File

@@ -0,0 +1,22 @@
//
// Created by viole on 2026/2/24.
//
#include "iostream"
#include "windows.h"
using namespace std;
int main() {
SetConsoleOutputCP(CP_UTF8);
//float 单精度浮点数4字节6-7位的有效位数
float num1 = 1234567890;
float num2 = 1.234567890;
double num3 = 1234567890.1234567890;
long double num4 = 1234567890.1234567890;
cout<<fixed;
cout.width(20);
cout<<num1<<endl;
cout<<num2<<endl;
cout<<sizeof(num2)<<endl;
cout<<num3<<","<<sizeof(num3)<<endl;
cout<<num4<<","<<sizeof(num4)<<endl;
}