c语言中对字段宽度的理解?


 1 /*************************************************************************
 2     > File Name: printf.c
 3     > Author: Mr.Yang
 4     > Purpose:演示printf的用法 
 5     > Created Time: 2017年05月21日 星期日 10时07分44秒
 6  ************************************************************************/
 7 
 8 #include <stdio.h>
 9 #include <stdlib.h>
10 
11 int main(void)
12 {
13         float i = 10000.123;
14 
15         printf("%5f\n",i);
16         printf("%10f\n",i);
17         printf("%15f\n",i);
18         printf("%20f\n",i);
19         printf("%25f\n",i);
20 
21         return 0;
22 }

运行结果:

10000.123047
10000.123047
   10000.123047
        10000.123047
             10000.123047

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM