资源描述:
《c语言复习资料》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#includevoidmain(){intk=68;floatt=64;printf(”k=%i,k+12=%d,%f”,k,k+12,sqrt(t));}1.结果K=68,k+12=80,8.000000结果#includevoidmain(){inta=65;charc=’!’;printf(”%d,%c”,a,a);printf(”c=%c,”,c);printf(”itsASCII=%d”,c);}2.结果65,
2、Ac=!,itsASCII=33结果#includevoidmain(){intb=–3;printf(”%d,%u,%x,%o”,b,b,b,b);}3.结果–3,65533,fffd,177775结果#includevoidmain(){intm=–0x15a,k=–346;printf(”%d,%x”,m,m);printf(”%d,%x”,k,k);}4.结果–346,fea6–346,fea6结果#includevoidmai
3、n(){intm=60000,k=-346;printf(”%#x%#10X”,k,k);printf(”%-9u,%8d”,m,m);}5.结果0xfea60XFEA660000,–5536结果#includevoidmain(){longx=1234567;printf(”%d,%ld”,x,x);}6.结果–10617,–695795694结果#includevoidmain(){longx=1234567;printf(”y=%d,”,x
4、);printf(”y=%ld”,x);}注意与上一页6.的区别结果y=–10617,y=1234567结果#includevoidmain(){intx=123;printf(”%06d”,x);printf(”1.x=%+06d”,x);printf(”2.x=%+6d”,x);printf(”3.x=%–06d&&&”,x);printf(”4.x=%+2d”,x);}7.结果0001231.x=+001232.x=+1233.x=123&&&4.x=+
5、123结果#includevoidmain(){printf(”[%+8s]”,”ruler”);printf(”%–8s,”,”ruler”);printf(”%8.3s,”,”ruler”);printf(”%.3s”,”ruler”);}8.结果[ruler]ruler,rul,rul结果#includevoidmain(){printf(”1.a=%+8.2f”,123.45678);printf(”2.a=%+8.2lf”,123.
6、45678);}9.结果1.a=+123.462.a=+123.46结果#includevoidmain(){printf(”1.a=%+8.2e”,123.45678);printf(”2.a=%+8.2E”,123.45678);printf("3.a=%g",12.3);printf("4.a=%G",12345678.9);}10.结果1.a=+1.2e+022.a=+1.2E+023.a=12.34.a=1.23457E+07结果#include7、.h>voidmain(){inta,b;unsignedc;a=30000;b=60000;c=60000;printf(”%d,%d”,a,c);printf(”%u,%u”,b,c);}11.结果30000,–553660000,60000结果#includevoidmain(){charc='A’;putchar(66);putchar('53’);putchar(c+2);putchar('’);putchar('7’);putchar('’);}12.结果B+C
8、7结果