printf 详解 笔记
Posted zzdoit
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了printf 详解 笔记相关的知识,希望对你有一定的参考价值。
先看代码:
#include <stdio.h> #define INTDEMO 250 int main() { const double DOUBLEDEMO = 3.14159; const short SHORTDEMO = 0xFFFF; printf("%2d\n",INTDEMO); printf("%10d\n", INTDEMO); printf("%-10d\n",INTDEMO); printf("%f\n", DOUBLEDEMO); printf("%Lf\n", DOUBLEDEMO); printf("%4.2Lf\n", DOUBLEDEMO); printf("%10.3Le\n", DOUBLEDEMO); printf("%10.3Lf\n", DOUBLEDEMO); printf("%010.3Lf\n", DOUBLEDEMO); printf("%+010.3Lf\n", DOUBLEDEMO); printf("%c", SHORTDEMO); float f_num = 3.0; double d_num = 3.0; int i_num = 2000000000; long l_num = 1234567890; printf("%.1g %.1g %.1g %.1g", f_num, d_num, i_num, l_num); printf("%ld %ld", i_num, l_num); printf("%ld %ld %ld %ld", f_num, d_num, i_num, l_num); printf("I""Love", "Mark"); getchar(); return 0; }
运行得出:
以上是关于printf 详解 笔记的主要内容,如果未能解决你的问题,请参考以下文章