正在加载图片...
第二部分¢语言程序设计同步训练 C)X=20,y=30,z=10 D)x=20,y=30,z=20 11.以下if语句语法正确的是()。 A)if(x>0) else printf(" %f, -x) B)if(x>0) i XX+y; printf("%f x);j else printf(" %of”;-x C)ifx>0) t XX+y; printf("%f, x);i else printf(%f”;-x) )if(x>0) else printf(" %f, -x) 12.请阅读以下程序 inta=5,b=5,c=0; printf("ss$\n”); 以上程序()。 A)有语法错不能通过编译B)可以通过编译但不能通过连接 C)输出* D)输出Sss 三、写出下列程序的运行结果 1.若运行时输入:2<回车>,则以下程序的运行结果是 #include <stdio. h void main(void) char Class printf("Enter 1 for lst class post or 2 for 2nd post")i scanf(”c",&C1ass); printf ("lst class postage is 19p") printf("2nd class postage is 14p")i 2.若运行时输入:44回车>,则以下程序的运行结果是 #include <stdio. h: void main(void) float CostPrice, SellingPrice;第二部分 C 语言程序设计同步训练 ·139· ·139· C) x=20,y=30,z=10 D) x=20,y=30,z=20 11. 以下 if 语句语法正确的是( )。 A) if(x>0) printf(“%f”,x) else printf(“%f”,-x); B) if(x>0) { x=x+y; printf(“%f”,x); } else printf(“%f”,-x); C) if(x>0) { x=x+y; printf(“%f”,x); }; else printf(“%f”,-x); D) if(x>0) { x=x+y; printf(“%f”,x) } else printf(“%f”,-x); 12. 请阅读以下程序 main() { int a=5,b=5,c=0; if(a==b+c) printf(“***\n”); else printf(“$$$\n”); } 以上程序( )。 A) 有语法错不能通过编译 B) 可以通过编译但不能通过连接 C) 输出*** D) 输出$$$ 三、写出下列程序的运行结果 1. 若运行时输入:2<回车>,则以下程序的运行结果是 。 #include <stdio.h> void main(void) { char Class; printf(“Enter 1 for 1st class post or 2 for 2nd post”); scanf(“%c”,&Class); if(Class==‘1’) printf(“1st class postage is 19p”); else printf(“2nd class postage is 14p”); } 2. 若运行时输入:4.4<回车>,则以下程序的运行结果是 。 #include <stdio.h> void main(void) { float CostPrice,SellingPrice;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有