这是我做的一个大作业吧,其实十分简单,但功能挺多。其中的播放音乐代码可以自行删去,因其需要环境配置与对应wav格式的音频,运行的时候有对应规则,要仔细看哦!

众所周知,打字能力是一个大学生必备的基本技能,打字的熟练与否决定了我们在很多场合的表现与否。该大作业的名为打字游戏,主要是因为本人打字水平太差,于是想编个程序帮助我训练打字,于是为了开启魔鬼训练模式以提升我的打字能力,我编写了这个程序用于训练我的打字准确度与打字速度,程序中的打字内容均采自于NASA官网。通过打字游戏的魔鬼训练,我们将会有所收获,有所成长。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <windows.h>
#include <conio.h>
#include <process.h>
#include <mmsystem.h>int i,m,n,seed,cnt,sumtime=0,len1,ddl=0,r,j;
double sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,sum=0,pon;
time_t start_time=0,end_time=0;
typedef struct record{double s1;double s2;double s3;double s4;double s5;double ss;char name[100];}record;
char a1[1000],o[100000],t1[1000],t2[1000],t3[1000],t4[1000],t5[1000],nname[100],out[3],an[3]={"out"};char p1[1000]={"National Aeronautics and Space Administration"};char p2[1000]={"America s civil space program"};char p3[1000]={"the only National Laboratory in space"};
char p4[1000]={"NASA also leads a Moon to Mars exploration"};char p5[1000]={"companies use NASA discoveries and technologies"};
char p6[1000]={"We typically look for two interns per internship period one undergraduate student and one graduate student"};char p7[1000]={"Interns will be paid a stipend based on the student s academic level and the length of the internship"};
char p8[1000]={"Once we receive your application via the NASA Internship site we may reach out to request"};char p9[1000]={"A cover letter that explains why you are interested when you will be available for work"};
char p10[1000]={"The work location is NASA Headquarters in Washington DC"};char p11[1000]={"Named in honor of the trailblazing astronomer Edwin Hubble the Hubble Space Telescope is a large space-based observatory which has revolutionized astronomy since its launch and deployment by the space shuttle Discovery"};
char p12[1000]={"Far above rain clouds light pollution and atmospheric distortions Hubble has a crystal-clear view of the universe"};
char p13[1000]={"Scientists have used Hubble to observe some of the most distant stars and galaxies yet seen as well as the planets in our solar system"};
char p14[1000]={"This is because new cutting-edge scientific instruments have been added to the telescope over the course of five astronaut servicing missions"};
char p15[1000]={"Hubble s domain extends from the ultraviolet through the visible which our eyes see and into the near-infrared"};
char p16[1000]={"This range has allowed Hubble to deliver stunning images of stars galaxies and other astronomical objects that have inspired people around the world and changed our understanding of the universe"};
char p17[1000]={"Over 19000 peer-reviewed science papers have been published on its discoveries and every current astronomy textbook includes contributions from the observatory"};
char p18[1000]={"The telescope has tracked interstellar objects as they soared through our solar system watched a comet collide with Jupiter and discovered moons around Pluto"};
char p19[1000]={"It has found dusty disks and stellar nurseries throughout the Milky Way that may one day become fully fledged planetary systems and studied the atmospheres of planets that orbit other stars"};
char p20[1000]={"Hubble has peered back into our universe s distant past to locations more than 13 4 billion light-years from Earth capturing galaxies merging probing the supermassive black holes that lurk in their depths and helping us better understand the history of the expanding universe"};
char p21[1000]={"Based at NASA s Johnson Space Center in Houston Texas the Gateway Program is building a small human-tended space station orbiting the Moon that will provide extensive capabilities to support NASA s Artemis campaign Built with international and commercial partnerships Gateway s capabilities for variety of visiting spacecraft"};
char p22[1000]={"space for crew to live and work and on-board science investigations to study heliophysics human health and life sciences among other areas Gateway will be a critical platform for developing technology and capabilities to support Moon and Mars exploration in the coming years"};
char p23[1000]={"HALO is where astronauts will live and conduct research while visiting Gateway The pressurized living quarters will provide command and control systems for the lunar outpost and docking ports for visiting spacecraft such as NASA s Orion spacecraft lunar landers and logistics resupply craft"};
char p24[1000]={"A near Earth object NEO is an asteroid or comet whose orbit brings it within a zone approximately 121 million miles 195 million kilometers from the Sun meaning that it can pass within about 30 million miles 50 million kilometers of Earth s orbit Like the planets asteroids and comets orbit the Sun Some of the smaller moons of other planets may be captured asteroids"};
char p25[1000]={"Observers find and track NEOs using ground based telescopes around the world and currently NASA s space-based NEOWISE infrared telescope The basic method of finding NEOs is to look for small objects moving across the background of relatively fixed stars"};void run1()
{seed=time(0);srand((unsigned int)seed);n=rand()%5;switch(n){case 0:strcpy(a1,p1);printf("%s\n",a1);break;case 1:strcpy(a1,p2);printf("%s\n",a1);break;case 2:strcpy(a1,p3);printf("%s\n",a1);break;case 3:strcpy(a1,p4);printf("%s\n",a1);break;case 4:strcpy(a1,p5);printf("%s\n",a1);break;}
}
void run2()
{seed=time(0);srand((unsigned int)seed);n=rand()%5;switch(n){case 0:strcpy(a1,p6);printf("%s\n",a1);break;case 1:strcpy(a1,p7);printf("%s\n",a1);break;case 2:strcpy(a1,p8);printf("%s\n",a1);break;case 3:strcpy(a1,p9);printf("%s\n",a1);break;case 4:strcpy(a1,p10);printf("%s\n",a1);break;}
}
void run3()
{seed=time(0);srand((unsigned int)seed);n=rand()%5;switch(n){case 0:strcpy(a1,p11);printf("%s\n",a1);break;case 1:strcpy(a1,p12);printf("%s\n",a1);break;case 2:strcpy(a1,p13);printf("%s\n",a1);break;case 3:strcpy(a1,p14);printf("%s\n",a1);break;case 4:strcpy(a1,p15);printf("%s\n",a1);break;}
}
void run4()
{seed=time(0);srand((unsigned int)seed);n=rand()%5;switch(n){case 0:strcpy(a1,p16);printf("%s\n",a1);break;case 1:strcpy(a1,p17);printf("%s\n",a1);break;case 2:strcpy(a1,p18);printf("%s\n",a1);break;case 3:strcpy(a1,p19);printf("%s\n",a1);break;case 4:strcpy(a1,p20);printf("%s\n",a1);break;}
}
void run5()
{seed=time(0);srand((unsigned int)seed);n=rand()%5;switch(n){case 0:strcpy(a1,p21);printf("%s\n",a1);break;case 1:strcpy(a1,p22);printf("%s\n",a1);break;case 2:strcpy(a1,p23);printf("%s\n",a1);break;case 3:strcpy(a1,p24);printf("%s\n",a1);break;case 4:strcpy(a1,p25);printf("%s\n",a1);break;}
}
double point1(int m,double pon)
{double s;s=m/10.0;if(s<=1&&s>0.8)pon=pon*0.6;else if(s<=0.8&&s>0.6)pon=pon*0.7;else if(s<=0.6&&s>0.4)pon=pon*0.8;else if(s<=0.4)pon=pon*1;return pon;
}
double point2(int m,double pon)
{double s;s=m/12.0;if(s<=1&&s>0.8)pon=pon*0.6;else if(s<=0.8&&s>0.6)pon=pon*0.7;else if(s<=0.6&&s>0.4)pon=pon*0.8;else if(s<=0.4)pon=pon*1;return pon;
}
double point3(int m,double pon)
{double s;s=m/13.0;if(s<=1&&s>0.8)pon=pon*0.6;else if(s<=0.8&&s>0.6)pon=pon*0.7;else if(s<=0.6&&s>0.4)pon=pon*0.8;else if(s<=0.4)pon=pon*1;return pon;
}
double point4(int m,double pon)
{double s;s=m/15.0;if(s<=1&&s>0.8)pon=pon*0.6;else if(s<=0.8&&s>0.6)pon=pon*0.7;else if(s<=0.6&&s>0.4)pon=pon*0.8;else if(s<=0.4)pon=pon*1;return pon;
}
double point5(int m,double pon)
{double s;s=m/16.0;if(s<=1&&s>0.8)pon=pon*0.6;else if(s<=0.8&&s>0.6)pon=pon*0.7;else if(s<=0.6&&s>0.4)pon=pon*0.8;else if(s<=0.4)pon=pon*1;return pon;
}
double grade1(char a1[i],char t1[i])
{j=0;for(i=0;i<len1;i++){if(a1[i]!=t1[i])j++;}pon=20-j;return pon;
}
double grade2(char a1[i],char t2[i])
{j=0;for(i=0;i<len1;i++){if(a1[i]!=t2[i])j++;}pon=20-j;return pon;
}
double grade3(char a1[i],char t3[i])
{j=0;for(i=0;i<len1;i++){if(a1[i]!=t3[i])j++;}pon=20-j;return pon;
}
double grade4(char a1[i],char t4[i])
{j=0;for(i=0;i<len1;i++){if(a1[i]!=t4[i])j++;}pon=20-j;return pon;
}
double grade5(char a1[i],char t5[i])
{j=0;for(i=0;i<len1;i++){if(a1[i]!=t5[i])j++;}pon=20-j;return pon;
}
void timer()
{cnt=3;while(--cnt>=0){Sleep(1000);printf("%-4d\r",cnt);printf("\a");}printf("开始!\n");
}
void timermax()
{cnt=5;while(--cnt>=0){Sleep(1000);printf("%-4d\r",cnt);printf("\a");}printf("现在揭晓结果!\n");
}int main()
{PlaySound(TEXT("amalata"),NULL,SND_FILENAME | SND_ASYNC | SND_LOOP);FILE *fp,*sortfp;record A[10000],tr;fp=fopen("recording.txt","a+");printf("欢迎来到打字游戏,本游戏作者wreg,侵权必究(按回车以继续,此后皆如此)。\n");gets(o);system("cls");printf("游戏规则:\n");printf("1,游戏有五个打字等级,每个等级有对应的3题。");gets(o);printf("2,对于每一题而言,一开始打字便开始计时,时间太长,无效,不计分。");gets(o);printf("3,每一题记20分,错一个词扣1分,每一题需满足15(其实不一定)分要求才可以过关。");gets(o);printf("4,每一等级需满足52分,同时总耗时达到要求才可过关,每一关难度逐渐提升,每做完一题可以看到当前分数与当前总分。");gets(o);printf("5,每题内容均为随机挑选,当一题没过关,可以再次尝试。");gets(o);printf("6,本题的要求就是在规定时间内输入相应内容,您的输入时长将与您的最终分数息息相关,请注意把控!");gets(o);printf("7,您大可以选择不玩游戏直接看之前的排名榜(您的分数将被记作0分处理),如有此愿,请输入out\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("现在,让我们开始吧!\n");gets(o);system("cls");t1:printf("第一关!第一题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run1();len1=strlen(a1);timer();start_time=clock();gets(t1);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>10){printf("您失败了,我们再来一次\n");goto t1;}else{pon=grade1(a1,t1);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t1;}}pon=point1(m,pon);printf("您的本题分数是%lf\n",pon);sum1=sum1+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum1);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;;system("cls");t2:printf("第一关!第二题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run1();len1=strlen(a1);cnt=3;while(--cnt>=0){Sleep(1000);printf("%-4d\r",cnt);printf("\a");}printf("开始!\n");start_time=clock();gets(t1);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>10){printf("您失败了,我们再来一次\n");goto t2;}else{pon=grade1(a1,t1);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t2;}}pon=point1(m,pon);printf("您的本题分数是%lf\n",pon);sum1=sum1+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum1);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t3:printf("第一关!第三题:\n");printf("\a");cnt=10,i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run1();len1=strlen(a1);timer();start_time=clock();gets(t1);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>10){printf("您失败了,我们再来一次\n");goto t3;}else{pon=grade1(a1,t1);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t3;}}pon=point1(m,pon);printf("您的本题分数是%lf\n",pon);sum1=sum1+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum1);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("恭喜你完成第一关,第二关难度会更大,但是,我们还有些要求\n");timermax();if(sum1>=52&&sumtime<=21){printf("你真棒,要求达到啦!");printf("开始挑战下一关吧!\n");}else {printf("很抱歉,我们得重新开始qwq\n");sum1=0;goto t1;}sumtime=0;gets(o);system("cls");t4:printf("第二关!第一题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run2();len1=strlen(a1);timer();start_time=clock();gets(t2);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>12){printf("您失败了,我们再来一次\n");goto t4;}else{pon=grade2(a1,t2);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t4;}}pon=point2(m,pon);printf("您的本题分数是%lf\n",pon);sum2=sum2+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum2);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t5:printf("第二关!第二题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run2();len1=strlen(a1);timer();start_time=clock();gets(t2);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>12){printf("您失败了,我们再来一次\n");goto t5;}else{pon=grade2(a1,t2);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t5;}}pon=point2(m,pon);printf("您的本题分数是%lf\n",pon);sum2=sum2+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum2);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t6:printf("第二关!第三题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run2();len1=strlen(a1);timer();start_time=clock();gets(t2);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>12){printf("您失败了,我们再来一次\n");goto t6;}else{pon=grade2(a1,t2);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t6;}}pon=point2(m,pon);printf("您的本题分数是%lf\n",pon);sum2=sum2+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum2);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("恭喜你完成第二关,第三关难度会更大,但是,我们还有些要求\n");timermax();if(sum2>=52&&sumtime<=27){printf("你真棒,要求达到啦!");printf("开始挑战下一关吧!\n");}else {printf("很抱歉,我们得重新开始qwq\n");sum2=0;goto t4;}sumtime=0;gets(o);system("cls");t7:printf("第三关!第一题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run3();len1=strlen(a1);timer();start_time=clock();gets(t3);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>13){printf("您失败了,我们再来一次\n");goto t7;}else{pon=grade3(a1,t3);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t7;}}pon=point3(m,pon);printf("您的本题分数是%lf\n",pon);sum3=sum3+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum3);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t8:printf("第三关!第二题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run3();len1=strlen(a1);timer();start_time=clock();gets(t3);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>13){printf("您失败了,我们再来一次\n");goto t8;}else{pon=grade3(a1,t3);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t8;}}pon=point3(m,pon);printf("您的本题分数是%lf\n",pon);sum3=sum3+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum3);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t9:printf("第三关!第三题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run3();len1=strlen(a1);timer();start_time=clock();gets(t3);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>13){printf("您失败了,我们再来一次\n");goto t9;}else{pon=grade3(a1,t3);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t9;}}pon=point3(m,pon);printf("您的本题分数是%lf\n",pon);sum3=sum3+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum3);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("恭喜你完成第三关,第四关难度会更大,但是,我们还有些要求\n");timermax();if(sum3>=52&&sumtime<=28){printf("你真棒,要求达到啦!");printf("开始挑战下一关吧!\n");}else {printf("很抱歉,我们得重新开始qwq\n");sum3=0;goto t7;}sumtime=0;gets(o);system("cls");t10:printf("第四关!第一题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run4();len1=strlen(a1);timer();start_time=clock();gets(t4);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>15){printf("您失败了,我们再来一次\n");goto t10;}else{pon=grade4(a1,t4);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t10;}}pon=point4(m,pon);printf("您的本题分数是%lf\n",pon);sum4=sum4+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum4);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t11:printf("第四关!第二题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run4();len1=strlen(a1);cnt=3;while(--cnt>=0){Sleep(1000);printf("%-4d\r",cnt);printf("\a");}printf("开始!\n");start_time=clock();gets(t4);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>15){printf("您失败了,我们再来一次\n");goto t11;}else{pon=grade4(a1,t4);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t11;}}pon=point4(m,pon);printf("您的本题分数是%lf\n",pon);sum4=sum4+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum4);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t12:printf("第四关!第三题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run4();len1=strlen(a1);timer();start_time=clock();gets(t4);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>15){printf("您失败了,我们再来一次\n");goto t12;}else{pon=grade4(a1,t4);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t12;}}pon=point4(m,pon);printf("您的本题分数是%lf\n",pon);sum4=sum4+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum4);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("恭喜你完成第四关,第五关难度会更大,也是最终关卡,但是,我们还有些要求\n");timermax();if(sum4>=52&&sumtime<=33){printf("你真棒,要求达到啦!");printf("开始挑战下一关吧!\n");}else {printf("很抱歉,我们得重新开始qwq\n");sum4=0;goto t10;}sumtime=0;gets(o);system("cls");t13:printf("第五关!第一题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run5();len1=strlen(a1);timer();start_time=clock();gets(t5);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>16){printf("您失败了,我们再来一次\n");goto t13;}else{pon=grade5(a1,t5);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t13;}}pon=point5(m,pon);printf("您的本题分数是%lf\n",pon);sum5=sum5+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum5);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t14:printf("第五关!第二题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run5();len1=strlen(a1);cnt=3;while(--cnt>=0){Sleep(1000);printf("%-4d\r",cnt);printf("\a");}printf("开始!\n");start_time=clock();gets(t5);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>16){printf("您失败了,我们再来一次\n");goto t14;}else{pon=grade5(a1,t5);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t14;}}pon=point5(m,pon);printf("您的本题分数是%lf\n",pon);sum5=sum5+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum5);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");t15:printf("第五关!第三题:\n");printf("\a");i=0;gets(o);printf("请在规定时间内输入以下内容!\n");run5();len1=strlen(a1);timer();start_time=clock();gets(t5);end_time=clock();printf("用时");m=(end_time-start_time)/CLOCKS_PER_SEC;printf("%d秒",m);if(m>16){printf("您失败了,我们再来一次\n");goto t15;}else{pon=grade5(a1,t5);if(pon>=15){printf("恭喜您顺利通关\n");}else if(pon<15){printf("您失败了,我们再来一次\n");goto t15;}}pon=point5(m,pon);printf("您的本题分数是%lf\n",pon);sum5=sum5+pon;sumtime=sumtime+m;printf("当前总分%lf\n",sum5);printf("your can surely choose to type 'out' to end everything\n");gets(out);if(strcmp(an,out)==0)goto ended;system("cls");printf("恭喜你完成第五关,但是,我们还有些要求\n");timermax();if(sum4>=52&&sumtime<=36){printf("你真棒,要求达到啦!\n");goto t16;}else {printf("很抱歉,我们得重新开始qwq\n");sum5=0;goto t14;}gets(o);system("cls");t16:sum=sum1+sum2+sum3+sum4+sum5;printf("您的所有最终总分是%lf\n",sum);if(sum==300)printf("您居然是举世无双的打字神手!\n");else if(sum<300&&sum>=290)printf("您是一个打字高手哦!\n");else if(sum<290&&sum>=280)printf("您的打字水平还可以哦!\n");else if(sum<280&&sum>=270)printf("您的打字水平还算说得过去。\n");else if(sum<280&&sum>=260)printf("您的进步空间很大!\n");cnt=15;ended:sum=sum1+sum2+sum3+sum4+sum5;while(--cnt>=0){Sleep(1000);for(i=cnt;i>=0;i--)printf(" ");printf("赞!!!\n");printf("\a");}printf("感谢您的参与,相信这个小游戏也让你的打字能力提升了不少吧!(不喜勿喷)\n");printf("小惊喜来了,打字高手表!(借鉴于教材例题…………………………)\n");gets(o);i=0;while(!feof(fp)){fscanf(fp,"%s%lf%lf%lf%lf%lf%lf",A[i].name,&A[i].s1,&A[i].s2,&A[i].s3,&A[i].s4,&A[i].s5,&A[i].ss);i++;}namer:printf("请输入一个昵称(more than one word),以便存入您的成绩:\n");gets(nname);for(j=0;j<i;j++){if(strcmp(A[j].name,nname)==0){printf("该昵称已存在");gets(o);system("cls");goto namer;}}printf("下面是排名表\n");if(strcmp(an,out)==0){printf("由于你没有成绩,所以按零分处理\n");}printf("从左到右,依次为第一关,第二关,第三关,第四关,第五关,总关卡所对应的分数\n");strcpy(A[i-1].name,nname);A[i-1].s1=sum1;A[i-1].s2=sum2;A[i-1].s3=sum3;A[i-1].s4=sum4;A[i-1].s5=sum5;A[i-1].ss=sum;fprintf(fp,"%s %lf %lf %lf %lf %lf %lf\n",A[i-1].name,A[i-1].s1,A[i-1].s2,A[i-1].s3,A[i-1].s4,A[i-1].s5,A[i-1].ss);fclose(fp);for(j=0;j<i-1;j++){for(r=j+1;r<i;r++){if(A[j].ss<A[r].ss){tr=A[j],A[j]=A[r],A[r]=tr;}}}sortfp=fopen("recordingsort.txt","w");for(j=0;j<i;j++)if(strlen(A[j].name)>1)fprintf(sortfp,"%s %lf %lf %lf %lf %lf %lf\n",A[j].name,A[j].s1,A[j].s2,A[j].s3,A[j].s4,A[j].s5,A[j].ss);fclose(sortfp);sortfp=fopen("recordingsort.txt","r");for(j=0;j<i;j++){if(strlen(A[j].name)>1)printf("名次%d 昵称%s sum1=%lf sum2=%lf sum3=%lf sum4=%lf sum5=%lf sum=%lf\n",j+1,A[j].name,A[j].s1,A[j].s2,A[j].s3,A[j].s4,A[j].s5,A[j].ss);}fclose(sortfp);return 0;
}
  1. 采用随机函数挑选打字内容,且尽量保证不重复。
  2. 游戏具有自动计时系统,以此来记录每一次的打字时间,不同关卡的规定时间都是不同的,自动计时系统带有倒计时显示与提示音。
  3. 游戏自动计分,计分规则很严,必须让每个单词与空格一           一对应,如果整体后移则全记为错,系统将评定您的分数,一题中,若分数不达标将重新开始这一题直到达标为止,除  了完成每一题,每个关卡末尾都有额外标准,未满足总体标   准也会变得不幸。
  4. 每完成一题后都会有提示语,整个游戏顺利过关后将将迎来我设置的神秘大惊喜。
  5. 采用打字速度与正确率双标准评分,更加科学可靠!
  6. 神秘大惊喜为一个排名表,程序带有存入成绩的功能。
  7. 打字过程还有音乐相伴amalata哈哈哈!

确实有点长,但练打字效果一流(魔鬼训练哈哈哈)代码十分简单,相信大家一定看得懂吧!

C语言大作业,可供学习---打字游戏相关推荐

  1. 大一期末C语言大作业—结构体和链表框架

    有很多大一的小白兔,学习C语言,在期末会有大作业 类似学生管理系统,酒店管理系统,电话簿管理系统 这种xxx管理系统大都是要求使用结构体和链表 本着授之以渔不如授之以渔的思想 我现在给出结构体和链表的 ...

  2. c语言倒计时不影响进程_2017级C语言大作业 - 见缝插针

    分享17级同学大一上学期用C语言实现的见缝插针.分步骤代码.图片音乐素材.可执行程序可从百度网盘下载: 链接:https://pan.baidu.com/s/1dblHmOD2z0cUiJk3XSqu ...

  3. 2010C语言添加背景图片_2019级C语言大作业 - 火柴人试炼之地

    C语言大作业 - 火柴人试炼之地https://www.zhihu.com/video/1200491618794606592 分享19级同学大一上学期用C语言实现的火柴人试炼之地.分步骤代码.图片音 ...

  4. 2020级C语言大作业 - 王国保卫战

    王国保卫战 C语言大作业 分享20级同学大一上学期用C语言(及少量C++)实现的王国保卫战.由于同学们刚学了三个月的编程,实现还不够完善,工程代码.图片音乐素材可以从百度网盘下载: 链接:https: ...

  5. 基于游戏开发的C语言大作业视频集锦

    基于游戏开发的C语言大作业视频集锦 从2014年至今,尝试了基于游戏开发的C语言程序设计教学,每次课程均会布置大作业,以下视频为一些学生做的大作业视频集锦. 基于游戏开发的C语言大作业视频集锦 后续, ...

  6. 2019级C语言大作业 - 火柴人试炼之地

    火柴人试炼之地 C语言大作业 分享19级同学大一上学期用C语言实现的火柴人试炼之地.分步骤代码.图片音乐素材.可执行程序可以从百度网盘下载: 链接:https://pan.baidu.com/s/1X ...

  7. 2018 C语言大作业--21_Ekko制作教程

    同学们实现的效果: Ekko C语言大作业 以下是开发同学的相关文档: <Ekko>设计报告 本组设计并编写的游戏<Ekko>,是一款引用了当下红火的网络游戏<英雄联盟& ...

  8. 2017级C语言大作业 - 见缝插针

    见缝插针 C语言作业 分享17级同学大一上学期用C语言实现的见缝插针.分步骤代码.图片音乐素材.可执行程序可从百度网盘下载: 链接:https://pan.baidu.com/s/1dblHmOD2z ...

  9. java泡泡龙开源_2019级C语言大作业 - 泡泡龙

    分享19级同学大一上学期用C语言实现的泡泡龙.分步骤代码.可执行程序可从百度网盘下载: 提取码:jcuc C语言大作业 - 泡泡龙https://www.zhihu.com/video/1207418 ...

最新文章

  1. Makefile 选项 CFLAGS 、LDFLAGS 、LIBS
  2. 获取远程网卡MAC地址
  3. ADO.NET 常用对象(18)
  4. python模块引用
  5. IE下及标准浏览器下的图片旋转(二)—— Canvas(2)
  6. ASP.NET页面生命周期概述(转载)
  7. flink离线mysql_Flink 流模式跑离线任务
  8. java AST 表达式_Atitti.java exp ast java表达式语法ast构造器
  9. mysql安全方面_MySQL数据库在网络安全方面功能有哪些呢?
  10. 2018最新Web前端经典面试试题及答案
  11. .net 跳出Frameset框架
  12. UVA 10733 - The Colored Cubes(Ploya)
  13. hijson,64位百度云永久免费,这是一个爱分享的世界
  14. 计算机在足球中的应用,人工智能在机器人足球赛中的应用
  15. [安全攻防进阶篇] 三.OllyDbg和Cheat Engine工具逆向分析植物大战僵尸游戏
  16. 【学习教程】CMIP6数据处理方法与典型案例分析
  17. VS2013 VS2015应用程序无法正常启动0xc000007b。
  18. Liberal Arts:志存高远
  19. MySQL学习1 基础入门
  20. 计算机的网关地址是什么,什么是网关 网关地址是什么

热门文章

  1. 推荐大家......必看的几部超级鬼片
  2. 下载上市公司财报并可视化某科目
  3. 邱姓女孩五行缺水取名
  4. 如何进行文献检索和阅读
  5. 030 正定二次型及判别法之定义法、特征值法、顺序主子式法
  6. adb脚本选择语句_常用adb命令汇总(绝对干货)
  7. 基于u3d_FPS_Demo
  8. Android让屏幕保持常亮,不熄屏的三种方法
  9. 如何成为一名卓越的软件工程师
  10. Quantopian自学笔记01