1、请用一个条件表达式写出:如果c的值是大写字母,则将其转换成对应的小写字母,否则其值不变。
2、请写一个C表达式,如果整型数a的个位数字是5,则表达式的值为非0,否则为0。
3、将下面if-else语句改成一个条件表达式语句。{
}
4、将下列嵌套的条件语句用switch语句改写,且功能等效(其中m是:1≤m<5的浮点类型数据)。{
}
5、下面程序的输出结果是什么。
#include<stdio.h>
int d=1;
int fun(int p)
{
static int d=5;
d+=p;
printf("%5d",d);
return d;
}
void main( )
{
int a=1;
printf("%5d\n",fun(a+fun(d)));
}
6.写出下面程序的运行结果。
7、下面程序的输出结果是什么。
#include<stdio.h>
void main( )
{
int a=0,i;
for(i=1;i<5;i++) {
switch(i) {
case 0:
case 3: a+=2;
case 1:
case 2: a+=3;
default: a+=5;
}
}
printf(“%d\n”, a );
}
8、写出下面程序的运行结果。
9、下面程序的输出结果是什么。
#include<stdio.h>
void main( )
{
int p[7]={11,13,14,15,16,17,18},i=0,k=0;
while(i<7&&p[i]%2) { k=k+p[i]; i++; }
printf(“%d\n”, k );
}
10、运行时输入xy后回车,下面程序的输出结果是什么。
4
对不对得起国家和人民,这不是由你说了算的,这种情况现在已成为了一种社会风气,你有能耐就别跟我说