C程序的练习题。

C程序的练习题。,第1张

1.B// 因为20/3 = 6,(double)强制转换为double型的,因此结果为 6.0

2. C //因为 ! 的优先级高于<, 所以先计算 !a == 0, 最后 0<20 为真,则表达式的值为 1

3.A

4.D

5.A

6.B

7.C //C语言的数据类型具体分类如下:

// 基本类型:分为整型、实型(又称浮点型)、字符型和枚举型四种。

// 构造类型:分为数组类型、结构类型和共用类型三种。

// 指针类型

// 空类型

8.D

9.A //因为 负号- 运算优先级高于++,且此处为后缀,所以先打印出 -i 的值,再对i进行++运算

10.A

11.B

12.D

13.D

14.C

15.A

16.D

二。填空题

1.顺序结构、选择结构、循环结构

4. 上限为 7 ,下限为0

5.5.6 //先进性除法运算 1/4 == 0,然后 5.6+0 = 5.6

6.a[1][0] = 4, a[2][2] = 8

7. 地址

#include<string.h>

#include<alloc.h>

#include<dos.h>

#define SIZE 30

win()

{

clrscr()

gotoxy(20,2)printf("*------------------------------*")

gotoxy(20,3)printf("* Fingering Training System *")

gotoxy(20,4)printf("*Designed By PrOve *")

gotoxy(20,5)printf("*2005-09-06*")

gotoxy(20,6)printf("*------------------------------*")

gotoxy(16,7)printf("...Press any key to entry the System...")

getch()

clrscr()

gotoxy(5,2)printf("Input original text:\n")

gotoxy(5,22)printf("------------------------------------------------------")

gotoxy(5,23)printf(" CorrectRate:%")

gotoxy(33,23)printf("Speed: w/s")

}

main()

{

char o1[150],o2[SIZE],o3[SIZE],o4[SIZE]/*每一行原文,最多150字符*/

char i1[150],i2[SIZE],i3[SIZE],i4[SIZE]/*每一行输入*/

int i

long error = 0,correct = 0

float crate

double speed

double ti

char flag

struct time t1,t2

start:win()

gotoxy(5,4)printf("------------------------------------------------------")

gotoxy(5,3)gets(o1)

gotoxy(5,6)printf("------------------------------------------------------")

gotoxy(5,5)gets(o2)strcat(o1,o2)

gotoxy(5,8)printf("------------------------------------------------------")

gotoxy(5,7)gets(o3)strcat(o1,o3)

gotoxy(5,10)printf("------------------------------------------------------")

gotoxy(5,9)gets(o4)strcat(o1,o4)

gotoxy(5,11)printf("Start Now!\n")

gotoxy(5,13)printf("------------------------------------------------------")

gettime(&t1)/*计时开始*/

gotoxy(5,12)gets(i1)

gotoxy(5,15)printf("------------------------------------------------------")

gotoxy(5,14)gets(i2)strcat(i1,i2)

gotoxy(5,17)printf("------------------------------------------------------")

gotoxy(5,16)gets(i3)strcat(i1,i3)

gotoxy(5,19)printf("------------------------------------------------------")

gotoxy(5,18)gets(i4)strcat(i1,i4)

gettime(&t2)/*计时结束*/

for(i = 0i <strlen(o1)i++)

{

if(o1[i] != i1[i])

error++

else

correct++

}

crate =(float) correct / (float)strlen(i1) * 100

ti = (double)((t2.ti_hour * 3600 + t2.ti_min * 60 + t2.ti_sec ) - (t1.ti_hour * 3600 + t1.ti_min * 60 + t1.ti_sec ))

speed = (double)strlen(i1) / (double)ti

gotoxy(20,23)printf("%f",crate)

gotoxy(40,23)printf("%lf",speed)

gotoxy(5,20)printf("Continue or Not(Y/N) ?")

flag = getch()

if(flag == 'y' || flag == 'Y')

goto start

else

{

clrscr()

gotoxy(26,7)printf("Welcome to use!")

gotoxy(19,8)printf("...Press any key to exit...")

getch()

exit(1)

}

getch()

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/10985115.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-12
下一篇 2023-05-12

发表评论

登录后才能评论

评论列表(0条)

保存