当前位置:网站首页>Printf function - conversion description
Printf function - conversion description
2022-07-24 00:25:00 【Blue_ lan18】
- Conversion instructions %4d Will be with -123 Display the number in the form of 123; Conversion instructions %-4d Will be with 123- The form shows 123.(- On behalf of the space )
# include <stdio.h>
int main()
{
printf("0123456789\n");
printf("%10d\n", 1234);
printf("%-10d\n", 1234);
return 0;
}
- e—— The index ( Scientific notation ) Floating point numbers in the form of .
- f—— Express “ Fixed point decimal ” Floating point numbers in the form of .
- g—— Represents a floating-point number in exponential form or fixed-point decimal form , The choice of form depends on the size of the number . If the value to be displayed does not have a number after the decimal point ,g The decimal point will not be displayed . however , When displaying very large or very small numbers , specifier g Will be converted to exponential form to reduce the number of characters required .
# include <stdio.h> int main() { int i; double x; i = 40; x = 839210; printf("|%d|%5d|%-5d|%5.4d|\n", i, i, i, i); //printf("|%10.3f|%10.4e|%-10g|\n", x, x, x); printf("%10.4e\n", x); return 0; }
边栏推荐
- Gbase 8C session information function (V)
- Redis分布式锁待续
- Pytest interface automated test framework | pytest generates simple test reports
- iNFTnews | 呵护“雪山精灵”,42VERSE“数字生态保护”公益项目即将盛启
- 二叉搜索树的简易实现及剖析
- Sed in-depth understanding and use
- GBase 8c 会话信息函数(五)
- 数据模型设计方法概述
- MySQL client to server character set conversion
- sed 深入理解与使用
猜你喜欢

Difference between data index and label system of data warehouse

总结谋划明方向 凝心聚力开新局——和数软件对口援疆项目显成效

win10下基于anaconda的detectron2安装

高数_第1章空间解析几何与向量代数__两点距

Application of encryption technology

Flutter | the easiest way to add header and footer to listview

High number_ Chapter 1 space analytic geometry and vector algebra__ Two point distance

YOLOv1

Problem note - unable to open include file: "direct.h": no such file or directory

数据模型设计方法概述
随机推荐
Try new methods
Gbase 8C access authority query function (III)
Implementation of singleton mode in C #
sed 深入理解与使用
Take stock of 10 new layer1 to prepare for the next bull market
GBase 8c 访问权限查询函数(三)
Pytest interface automated testing framework | common running parameters of pytest
Multi knapsack explanation of dynamic programming knapsack problem
GBase 8c模式可见性查询函数(二)
How to open a low commission account? Is it safe?
php实现 Stripe订阅
Codeforces Round #807 (Div. 2)(A-D)
paypal订阅流程及api请求
Résumé du websocket minier
GBase 8c 访问权限查询函数(一)
Summary of pit websocket
Jenkins 使用sonarqube构建流水线代码审查项目
Redis 集群hash分片算法(槽位定位算法)
Gbase 8C system table information function (III)
I like investing