资源描述:
《2分析程序题库》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、二•分析程序运行结果题库1.#includemain(){inti=16,j,x=6;j=i+++l;x*=i=j;prinlf("%d,%d",j,x);}运行结果是:2.#include#includemain(){inta=l,b=4,c=2;floatx=10・5,y=4.0,z;z=(a+b)/c+sqrt((double)y)*1.2/c+x;printf(“%hn'',z);)运行结果是:3•#includemain(){inta,b,c,d;a=c=0;b=l;d=20;if(a)d=d-
2、10;elseif(!b)if(!c)d=25;elsed=15;printf(ttd=%d,,,d);}运行结果:4.main()inti=10;switch(i){case9:i+=l;case10:i+=l;case11:i+=l;default:i+=l;)printf(tt%d,,,i);}运行结果:4.#includemain(){inta[]={l,2,3,4},i,j,s=0;j=l;for(i=3;i>=0;i-){s二s+a[i]*j;}printf(Hs=%dH,s);}运行结果:6・func(intx){x=20;}main()
3、{intx=10;func(x);printf(“%d”,x);)运行结果:7.main(){inta=5,b=4,x,y;x=a++*a++*a++;printf("a=%d,x=%d”,a,x);y=—b*--b*—b;printf(66b=%d,y=%d,b,y);8・#includevstdio.h>main(){structs1{charc[4],*s;}s1二{“abc",''def'};structs2{char*cp;structsiss1;}s2={“ghi",『'jkF',”mno”}};printf(u%c%cM,s1.c[O],*sl.s)
4、;printf(tt%s%s,sl.c,sl.s);printf("%s%s”,s2.cp,s2.ssl.s);prinlf(“%s%s",++s2.cp,++s2・ssl.s);9.#includefunc(intb[J){intj;for(j=0;j<4;j++)bU]=j;}main(){inta[4],k;func(a);for(k=0:k<4;k++)printf(“%d'',a[k]);10.voidfun(){staticinta=5;a++;printf(5、<=1;m++)fun();11•#includevoidfun(intx)x=20;}main(){intx=10;fun(x);printf(°x=%d",x);}运行结果是:12.#includevoidfun(intb[4]){intj;for(j=0;j<4;j++)b[j]=j;}main(){inta[4]={l,2,3,4},k;fun(a);for(k=0:k<4;k++)printf(H%dM,a[k]);}运行结果是:13.#includemain(){inti=10;switch(i)case
6、9:i+=10;case10:i+=10;case11:i+=10;break;printf(ni=%di);}运行结果是:14.#includevoidfun(){staticinta=5;a++;printf("a=%d",a);}main(){intm;for(m=0;m<=l;m++)fun();}运行结果是:15.#includemain(){inti,j,m;inta⑵⑸二{1,20,32,14,5,62,87,38,9,10};m=a[0][0];for(i=0;i<2;i++)for(j=0;j<5;j++)if(m
7、main()intx,y;scanf(H%2d%*2s%2dM,&x,&y);printf(H%d'x*y);}程序执行时从键盘输入:12341234/运行结果是:17.#includevoidFunc(intb[J){intj;for(j=0;j<4;j-H-){b[j]=j+l;}}main(){staticinta[4]={5,6,7,8},