Develop a program for students to practice spelling the names English of months.——c语言编程
题目
Develop a program for students to practice spelling the names English of months.——c语言编程
Develop a program for students to practice spelling the names English of months.The Chinese names of the months are displayed randomly and the student needs to enter the corresponding English names.If the spelling is correct,display “Right”; otherwise display “Wrong”.When the student enters “end”,his score of the achievement is displayed and the program stops.The user interface is shown below.
答案
#include "stdio.h"
char *MNT[] = {"January","Feburary","March","April","May","June","July","August","September","October","November","December"};
void main()
{
char x[0x200] = {0}
srand(time());
while(1)
{
int i = rand()%12;
printf("%d月:",i+1);
scanf(x,"%s",x);
if(strcmp(x,"end")==0)return;
if(strcmp(x,MNT[i])==0)
{
printf("Correct
");
}
else
{
printf("Wrong
");
}
}
}
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
热门考点