正在加载图片...
The C Programming language Chapter 4 Input and Output 4.2 Formatted output -- Printf printf (char *format, argl, arg2,..) printf converts, formats, and prints its arguments on the standard output under control of the format printf max=%d, min=%05d\n,a, b) 沙 Notice: The fol例ita ects: printf(%od %dn, a, b) Ordinar printf(a=%d, b=%d\n?", a, b); eam, Convers输出结果:34 and printing of the a=3.b=4 %o modifier conversion characterThe C Programming Language Chapter 4 Input and Output ➢ printf (char *format, arg1,arg2, ...) ➢ printf converts ,formats,and prints its arguments on the standard output under control of the format 4.2 Formatted output --- Printf Notice : The format string contains two types of objects: ▪Ordinary characters: copied to the output stream; ▪Conversion specifications: cause conversion and printing of the next successive arguments to printf. % [modifier] conversion character 例 int a=3,b=4; printf(“%d %d\n”,a,b); printf(“a=%d , b=%d\n”,a,b); 输出结果: 3 4 a=3, b=4 printf (“max=%d,min=%5d\n” , a , b);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有