printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1");
gotoxy(1,2);
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1");
gotoxy(1,3);
printf("\1\1\1 \1\1\1"); gotoxy(1,4);
printf("\1\1\1 \1\1\1"); gotoxy(1,5);
printf("\1\1\1 \1\1\1"); gotoxy(1,6);
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1");
gotoxy(1,7);
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1");
gotoxy(8,4);
printf("Are you sure to exit?(Y/N)"); gotoxy(1,27); key=0;
while(key!='Y' && key!='y' && key!='N' && key!='n') { key=getch(); putchar(key); getch();
if(key=='N' || key=='n') {
textbackground(bgcol[0]); clrscr();
textbackground(bgcol[0]); textcolor(7);
打字练习的课程设计分析以及代码
window(2,3,79,23); gotoxy(x,y); gch[j]=getch(); putchar(gch[j]); if(gch[j]==out[j]) right++;
else wrong++; wrong--; }
if(key=='Y'||key=='y') exit(0); }
goto line; }
if(gch[j]==out[j]) right++; else {
wrong++; sound(140);
delay(90000000); nosound(); } j++;
total=right+wrong; }
end=clock(); }
while((j!=zz)&&(m!=0)); gotoxy(27,20); printf("right:%3.0f wrong:%3.0f usetime:%3.0fS",right,wrong,total,(end-begin)/CLK_TCK); if((fp=fopen("recore.txt","w"))==NULL) {gotoxy(4,18);
printf("cannot open file"); return;}
fscanf(fp,"%c %5.4f",rename,&rerate); if(strcmp(uname,rename)==0)
if(rerate>(right/(right+wrong)))
fprintf(fp,"%c 5.4f%",uname,right/(right+wrong)); else
fprintf(fp,"%c 5.4f%",uname,right/(right+wrong)); fclose(fp);
window(1,1,80,25);
total:%3d
打字练习的课程设计分析以及代码
}
/*输入名字,模式,字数*/ void User() {
textbackground(GREEN); textcolor(7);
window(2,3,79,23); clrscr(); gotoxy(2,3);
printf("Please enter your name:"); gotoxy(25,3); gets(uname); gotoxy(2,4);
printf("Instruction:1.(very easy)Only Lowercase."); gotoxy(2,5);
printf(" 2.(easy)Lowercase and Uppercase."); gotoxy(2,6);
printf(" 3.(hard)Mixture with Lowercase,Uppercase,Number and Symbol."); gotoxy(2,7);
printf("Please choose the textmode(1-3):"); gotoxy(34,7); gets(choosec); gotoxy(2,8);
printf("Please enter the count(1-300):"); scanf("%d",&zz); gotoxy(2,9);
printf("The textmode you chooes is:%s",choosec); gotoxy(2,10);
printf("Your name is:"); printf("%s",uname); gotoxy(2,11);
printf("The count you choose is:%d",zz); window(1,1,80,25); }
/*背景颜色*/ void Bgcolor() { bgcol[0]=1;
textbackground(GREEN); textcolor(7);
window(2,3,79,23); clrscr();
打字练习的课程设计分析以及代码
gotoxy(2,3);
printf("Color instruction:"); gotoxy(2,4);
printf(" 0-BLACK"); gotoxy(2,5);
printf(" 1- BLUE"); gotoxy(2,6);
printf(" 2- GREEN"); gotoxy(2,7);
printf(" 3- CYAN"); gotoxy(2,8);
printf(" 4- RED"); gotoxy(2,9);
printf(" 5- MAGENTA"); gotoxy(2,10);
printf(" 6- BROWN"); gotoxy(2,11);
printf(" 7- LIGHTGRAY"); gotoxy(2,12);
printf("Note:Textcolor and textbackground must be different!!!!!"); gotoxy(2,13);
printf("Please enter the textbackground(0-7):"); x=wherex(); y=wherey();
bgcol[0]=getch(); if(bgcol[0]!='\033') putchar(bgcol[0]);
line1: if(bgcol[0]=='\033') {
gotoxy(50,21);
printf("Are you sure exit?(Y/N)"); gotoxy(73,21); key=0;
while(key!='Y' && key!='y' && key!='N' && key!='n') {key=getch(); putchar(key); getch();
if(key=='N' || key=='n') { gotoxy(50,21);