2015.11.C语言半期考试卷及答案副本.docx

2015.11.C语言半期考试卷及答案副本要点

写出以下程序段的运行结果(48分)1.(4分)int x=5, y=4;int a,b;a=(--x==y++)?x:++y;b=++x;printf(%d,%d,a,b);2.(4分)int v1 = 10 ;float v2 = 2.5 ;float v3 ;int v4 ;float v5;char v6;v3 = v1 / v2; v4 = v1 / v2; v5 = v1 / 4;v6 = v1 + 246;printf(%f,%d,%f,%d,v3,v4,v5,v6);3.(4分)int k=4, n=0;for (;nk;){ n++; if (n%2 == 0) continue; k--;}printf(k=%d, n=%d,k,n);4.(4分)int x=10,y=20,t=0;if(xy)t=x;x=y;y=t;printf(%d,%d,x,y);5.(4分)float f=2.345;int b=5;double a;a = (double)((int)f+5);f = a||(5-b++);printf(a=%lf,, a);printf(b=%d, b);6.(4分)int x;scanf(%d,x);if(x15)printf(%d,x-5);if(x10)printf(%d,x);if(x5)printf(%d,x+5);若程序运行时从键盘输

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档