第一章 初始C语言---什么是C语言
选择题
A
C
A
A
D
填空题
函数
;
main main
过程
#include
第二章 程序的灵魂---算法
选择题
A (解析:if语句后面仅执行了一条a=b,b=c;,语句c=a;,为if以外的语句,因此,此程序只执行了这条语句。)
D
C
A
D
填空题
顺序结构
13
1
a=2,b=1
1
第三章 基础是一切技能的本源---基本数据类型
选择题
D
A
B
D
D
填空题
数据类型
整型类型 字符型 实型或浮点型 枚举类型
长整形 短整型 符号整型 无符号整型
A=%d\n b=%d\n
How are you?How
第四章 万丈高楼平地起---运算符与表达式
选择题
C
C
D
A
B
填空题
a=-b
12
5
1
0
第五章 体验逻辑之美---程序结构
选择题
D
C
A
C
C
上机题
一、
#include
int main()
{
int Y,X;
int Switch;
printf("please enter X:");
scanf("%d",&X);
if(X<1)
{
Switch=1;
}
else if(1<=X&&X<10)
{
Switch=2;
}
else
{
Switch=3;
}
switch(Switch)
{
case 1:
break;
case 2:
Y=2*X-1;
break;
case 3:
Y=3*X-11;
break;
default:
break;
}
printf("Y is:%d\n",Y);
return 0;
}
二、
#include
int main()
{
int a,b,c;
printf("please enter three numbers\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
if(a>c)
{
printf("the max is a: %d\n",a);
}
else
{
printf("the max is c: %d\n",c);
}
}
else
{
if(b>c)
{
printf("the max is b: %d\n",b);
}
else
{
printf("the max is c: %d\n",c);
}
}
return 0;
}
第六章 串起数据的珍珠链---数组及其使用
选择题
B
B
B
B
C
上机题
一、
#include
main()
{
char s1[30],s2[30];
int i=0;
printf("请输入字符串1:\n");
gets(s1);
while(s1[i]!='\0')
{
s2[i]=s1[i];
i++;
}
s2[i]='\0';
printf("字符串2:\n");
puts(s2);
}
二、
#include
main()
{
char string[50];
int i=0,letter=0,dig=0,spa=0,other=0;
printf("请输入一组字符串:\n");
gets(string);
while(string[i]!='\0')
{
if(string[i]>='A'&&string[i]<='Z'||string[i]>='a'&&string[i]<='z')
letter++;
else if(string[i]==' ')
spa++;
else if(string[i]>='0'&&string[i]<='9')
dig++;
else
other++;
i++;
}
printf("字符:%d\n数字:%d\n空格:%d\n其他字符:%d\n",letter,dig,spa,other);
}
第七章 化整为零---函数及其使用
选择题
A
B
C
C
C
上机题
一、
#include
void Max(int iNum1,int iNum2);
int main()
{
int iNum1, iNum2;
printf("请输入两个要比较的数:\n");
printf("第一个数是:");
scanf("%d",&iNum1);
printf("第二个数是:");
scanf("%d",&iNum2);
Max(iNum1,iNum2);
r