玻璃板式液位计:要交C语言作业急

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 01:03:04
二、填空题(本大题共15小题)
1.设a=10,则赋值表达式a+=a-=a*a的值是 。
2.设a=3,b=4,c=5。则逻辑表达式a||b+c&&b-c的值是 。
3.若已知定义a =10, b=20, 则表达式 ! a<b 的值为 。
4.若有定义 int a [3][4]={{1,2}, {0},{ 4,6,78,10}}; 则初始化后a[1][2]得到的初值是 (1) ,a[2][1]得到的初值是 (2) 。
5.下面程序段的输出结果是 。
main()
{ int x=1, y=0;
switch ( x)
{ case 1:
switch ( y )
{ case 0: printf(“**1**\n”);; break;
case 1: printf(“**2**\n”);; break;
}
case 2:
printf(“**3**\n”);
}
}
6.下面程序段的输出结果是 。
main()
{ int x=3,y=6,a=0;
while (x++!=(y-=1))
{ a+=1;
if (y>x) printf("x=%d, y=%d, a=%d",x,y,a);
}
}

7.下面程序输出结果是_____________________。
#include <stdio.h>
main()
{ int i,j,k=19;
While (i=k-1)
{ k- =3;
if (k%5==0) { i++; continue; }
else if (k<5) break;
i++;
}
Printf(“i=%d,k=%d\n”,i,k);
}
8.如下程序段的输出结果是 。
int i=0 , sum=1;
do {
sum+=i+ +; }
while ( i<6);
printf(“%d”, sum);

9.下列的for循环执行 次。[4]
for ( x=0, y=0; ( y!=99) && x<4; x++ );

10.若x 是int型变量,下面程序段的输出结果是 。
for ( x=3; x<6 ; x++ )
printf ( ( x%2 ) ? ( “ ** %d”) : (“## %d\n”), x);

11.补足程序,实现如下功能:从键盘上输入若干个学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入。
main()
{ float score, max=0, min=0;
printf(“ Input the score”);
scanf( “ %f”, &score);
while ( (1) )
{ if ( score > max) max=score;
if ( (2) ) min=score;
printf(“ Input the score”);
scanf( “ %f”, &score);
}
printf(“ The max score is %f \n min is %f\n”,max, min);
}
12.以下程序的功能是实现从键盘输入一组字符,统计出大写字母的个数m和小写字母的个数n,并输出m、n中的较大者。
main()
{ int m= 0, n=0;
char c;
while ( ( (1) ) != ‘\n’ )
{ if ( c>=’A’ &&c <=’Z’ ) m++;
if ( c>=’a’ &&c <=’z’ ) n++;
}
printf(“%d \n ”, m<n ? (2) );
}

13.下面程序段将输出 computer,请填空。
int i, j=0;
char c[ ]=”it’s a computer”;
for (i=0; (1) ;i++)
{ (2) ; printf(“%c”,c[j];)
14. 如下程序段的输出结果是 。
#include <stdio.h>
main()
{ char str[]="1a2b3c" ; int i;
for (i=0; str[i]!='\0';i++)
if (str[i]>='0'&&str[i]<='9') printf("%c",str[i]);
}
15.如下程序段的输出结果是 。
#include <stdio.h>
main()
{ char str[][10]={"ABCD","EFGH","IJKL","MNOP"},k;
for (k=1; k<3;k++)
printf("%s\n",str[k]);
}

1.-180
2.0
3.0
4.0 6
5.**1**
**3**
6.4 4 1
7.2 4
8.6
9.无数
10.5

天桥云赏是白痴
1.-180
2.-3
3.1
4.0 6
5.
**1**
**3**
6.4 5 1
7.i=6,k=4
8.16
9.4
10.
** 836## 836
** 836
11.
(1)score>=0(2)score <min
12.
(1)c=getch() (2)m
13.
(1)i<=strlen(c)
if(c[i]!=c)break;
14.
123
15.
EFGH
IJKL

你就不能自己做做啊