mirror of
http://106.12.3.193:3000/violeteverisland/learn_cpp.git
synced 2026-03-07 17:17:33 +08:00
1
This commit is contained in:
22
实型数据类型.cpp
Normal file
22
实型数据类型.cpp
Normal 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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user