当前位置:网站首页>[code hoof set novice village 600 questions] the implementation of scientific counting method, output index form
[code hoof set novice village 600 questions] the implementation of scientific counting method, output index form
2022-07-19 13:38:00 【Sandm *】
Topic link :
Their thinking :
Scientific enumeration :
- Integer counting method :
(1)7.823E5=782300, This expression is :E representative 10,E The following numbers represent digits , Like here 5 The representative index is 10 Of 5 Power
(2)1234567 = 1.234567E+6, This expression is :1. It means 1.234567 Multiply by the following number , That's what's behind it E+6 It means 10 Of 6 Power
- Decimal counting
(1)1.23456e+002 , The representation of this number is ,e+002 Express 10 Of 2 Power , The number here is 123.456.
(2)202 +0.00000E+00, Such a number is expressed as 202 Add a number that is accurate to five decimal places

stay printf The format controller is used in the function to output decimals in exponential form
stay C++ We can use keywords scientific To achieve exponential printing
But these two methods can only output the last two digits
This topic requires the output of the last three digits
So we can write a function to find scientific counting method by ourselves
Reference code :
#include<bits/stdc++.h>
using namespace std;
double a = 3.1415926,b = 12345678.123456789;
void solve (double a)
{
printf("%.6lf",a);
int i = 0;
while(a > 10)
{
a = a/10.0;// Don't forget the decimal point
i++;
}
printf(" %.6lfe+",a);
cout << setw(3) << setfill('0') << i ;
return;
}
int main( )
{
solve(a);
cout << endl;
solve(b);
return 0;
}边栏推荐
- onvif协议相关:2.1.2 none方式获取截图url
- Wrong again, byte alignment and the use of pragma pack
- Onvif protocol related: common class description
- Codeforces Round #808 (Div. 2)ABCD
- 弘业期货网上开户安全吗?有没有开户指引?
- Hello, everyone. How to synchronize binlog in real time before the database starts? Is there a good scheme
- Responsive Zhimeng template logistics and freight service website
- Onvif protocol related: 3.1.2 get the token list in digest mode
- Array simulation queue
- 【码蹄集新手村 600 题】float 与 double 的格式说明符
猜你喜欢
![Codeforce:a. doremy's IQ [reverse greed]](/img/3d/065f9f1cbd857d324b6ed074d1afbf.png)
Codeforce:a. doremy's IQ [reverse greed]

语音通信网络的原理

Design and Simulation of anti reverse connection circuit based on MOS transistor

Onvif protocol related: 3.1.3 get screenshot URL in digest mode

Attachment handling of SAP Fiori

codeforce:G. Good Key, Bad Key【贪心】

Computer dial-up Internet access

Flutter 使用 AnimatedSwitcher 做场景切换

Module 7 (Architecture Design of King glory mall)

Onvif protocol related: 2.1.2 get screenshot URL in none mode
随机推荐
【码蹄集新手村 600 题】针对于字符串的格式化控制,即字符串的宽度与精度
【码蹄集新手村 600 题】float 与 double 的格式说明符
【码蹄集新手村 600 题】计算一个整数有多少位数
Three methods of realizing network request in pyodide
[Tencent blue whale] the seventh 7.24 operation and maintenance day holiday greetings ~ come and make a wish~
Use golang to correctly process the IP data of the five major Internet registration agencies
Weekly summary (*65): planned output
Advanced C language -- character function and string function
JVM self study summary
S32K148_ Can drive (bare metal development)
codeforce:A. Doremy‘s IQ【反向贪心】
【考研词汇训练营】Day 6 —— eventually,state,create,productivity,stimulate
Transphorm's surface mount packaging product series adds industry standard to-263 (D2Pak) packaging products to expand the advantages of supergan platform
Template virtual machine environment preparation
How to upgrade Flink job gracefully?
Onvif protocol related: 4.1.3 WS username token method to obtain screenshot URL
Li Kou's 302 weekly match
如何优雅的升级 Flink Job?
【码蹄集新手村 600 题】格式化的输入输出,使用 0 来代替补全的空格
动手学深度学习(第二版)注释后代码【持续更新】