二、选择题 1.A 2.B 3.B 4.B 5.C 6.C 7.D 8.C 9.D 10.D
三、程序分析
public class example{
public static void main(String args[]){
int x=1
if (x>0) x=2
switch(x){
case 1: System.out.println(1)
case 0: System.out.println(0) break
case 2: System.out.println(2)
case 3: System.out.println(3) break
default:System.out.println(4) break }
输出2,3
2.以下语句输出的结果是 。
String str=”123”
int x=4,y=5
str=str+(x+y)
System.out.println(str)
输出1239
11 D 14 A15 D16 D17 C 18 B 19 D20 C23:0 24 p=&a[8]25 11 29 无返回值 ;30 rb+;
31 s=5
32 10101
33 20,40,30,60
34 Lilei 40 2000.000000
35: 14 15 16(此踢要注意空格 每个数字前面都有 两个空格的)
39#include<stdio.h>
main()
{
int i,j
for(i=9i>=1i=i-2)
{
for(j=0j<ij++)
printf("&")
printf("\n")
}
}
40#include<stdio.h>
main()
{
int year,i,j
printf("Input the year: ")
scanf("%d",&year)
i=year%4
j=year%400
if(i==0 &&j!=0)
printf("yes!")
else("No!")
}
41#include<stdiio.h>
void change(double *a,double *b)
main()
{
double x,y
printf("Input x and y: ")
scanf("%d %d",&x,&y)
change(&x,&y)
printf("%d %d",x,y)
}
void change(double *a,double *b)
{
double temp
temp=*a
*a=*b
*b=temp
}
上面的都是自己作的,或许有不对的地方 还请指教 要是有什么不懂的可以给我留言~~再有就是关于23题,我是按10<3+1这个表达式做的 我觉的你可能是写错了 要是按你写的 我在电脑上面试了一下 输出的是160~~~呵呵
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)