2023年12月11日发(作者:文明近义词)
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "dos.h"
void hidecursor() /* 隐藏光标 */
{
union REGS r1,r2;
=0x100;
=-1;
int86(16,&r1,&r2);
}
void showcursor() /* 显示光标 */
{
union REGS r1,r2;
=0x100;
=0x0c0d;
int86(16,&r1,&r2);
}
main()
{
int x,y,i,t,a[3],n,*p,k,m=1,q,t3,t4;
char b[100],c[1000],d[1000];
struct time t1,t2;
float accuracy,right=0,wrong=0;
FILE* p1,p2,p3;
randomize();
textcolor(14);
for(x=1,y=1;x<=80;x++)
{
gotoxy(x,y);
putch(205);
}
for(x=1,y=20;x<=29;x++)
{
gotoxy(x,y);
putch(205);
}
for(x=1,y=24;x<=79;x++)
{
gotoxy(x,y);
putch(205);
} for(x=1,y=2;y<=24;y++)
{
gotoxy(x,y);
putch(186);
}
for(x=29,y=2;y<=24;y++)
{
gotoxy(x,y);
putch(186);
}
for(x=80,y=24;y>=2;y--)
{
gotoxy(x,y);
putch(186);
}
gotoxy(1,1);
putch(201);
gotoxy(29,1);
putch(203);
gotoxy(80,1);
putch(187);
gotoxy(1,20);
putch(204);
gotoxy(29,20);
putch(185);
gotoxy(1,24);
putch(200);
gotoxy(29,24);
putch(202);
gotoxy(80,24);
putch(188);
gotoxy(3,22);
cprintf("Level:1 Start Exit");
gotoxy(6,3);
cprintf("<< High Scores >>");
p=b;
n='a';
for(i=0;i<=100;i++)
{
b[i]=n;
n++;
if(n=='z'+1)
n='A'; if(n=='Z'+1)
{b[++i]=' ';
n='0';
i++;
for(t=0;t<10;t++)
b[i++]=n++;
b[i++]=',';
b[i++]=';';
b[i++]='.';
b[i++]=''';
b[i++]='/';
b[i++]='-';
b[i++]='=';
b[i++]='~';
b[i++]='!';
b[i++]='@';
b[i++]='#';
b[i++]='$';
b[i++]='%';
b[i++]='^';
b[i++]='&';
b[i++]='*';
b[i++]='(';
b[i++]=')';
b[i++]='+';
b[i++]='<';
b[i++]='>';
b[i++]='?';
break;}
} textcolor(14);
textbackground(0);
gotoxy(30,13);
cprintf(" Press UP/DOWN arrow to change Level.
gotoxy(10,22);
t=1;
textcolor(0);
textbackground(15);
gotoxy(3,22);
cprintf("Lever:%d",m);
n=1;
XU:
while(1) {
if(t==1)
"); while(1){ k=bioskey(0);
textcolor(0);
textbackground(15);
if(k==0x4800)
m++;
if(k==0x5000)
m--;
if(m<1)
m=3;
if(m>3)
m=1;
gotoxy(9,22);
cprintf("%d",m);
if(k==0x4b00)
{t=3;
goto XZ;
}
if(k==0x4d00)
{
t=2;
goto XZ;
}
}
if(bioskey(1)){
k=bioskey(0);
if(k==0x11b)
break;
if(k==0x4b00)
t--;
if(k==0x4d00)
t++;
if(t<1)
t=3;
if(t>3)
t=1;
XZ: textcolor(14);
textbackground(0);
if(n==1)
{gotoxy(3,22);
cprintf("Lever:%d",m);}
if(n==2) {gotoxy(13,22);
cprintf("Start");}
if(n==3)
{gotoxy(22,22);
cprintf("Exit");}
textcolor(0);
textbackground(15);
if(t==1)
{gotoxy(3,22);
cprintf("Lever:%d",m);
n=t;
gotoxy(30,13);
textcolor(14);
textbackground(0);
cprintf(" Press UP/DOWN arrow to change Level.
gotoxy(11,22);
}
if(t==2)
{gotoxy(13,22);
cprintf("Start");
n=t;
gotoxy(30,13);
textcolor(14);
textbackground(0);
cprintf(" Get ready ... ... GO!
gotoxy(18,22);
}
if(t==3)
{gotoxy(22,22);
cprintf("Exit");
n=t;
gotoxy(30,13);
textcolor(14);
textbackground(0);
cprintf(" Exit this game
gotoxy(26,22);
}
if(k==0x1c0d)
{if(t==2)
goto SHUCHU;
if(t==3)
");
");
");
exit(0);
}
}
}
SHUCHU: /*输出打字内容*/
for(x=30,y=2,q=0;y<23;x++,q++)
{
i=m-1;
a[0]=random(53);
a[1]=random(67);
a[2]=random(85);
gotoxy(x,y);
printf("%c",b[a[i]]);
d[q]=b[a[i]];
if(x==79)
x=29,y+=2;
}
for(x=30,y=3,q=0;y<23;x++,q++)
{
gotoxy(x,y);
printf(" ");
if(x==79)
x=29,y+=2;
}
gettime(&t1);
for(x=30,y=3,i=0;y<24;) /*开始打字*/
{
k=bioskey(0);
if(k==0x11b)
{gettime(&t2);
textcolor(9);
textbackground(7);
for(x=39,y=8;x<71;x++)
{
gotoxy(x,y);
putch(196);
}
for(x=39,y=18;x<71;x++)
{
gotoxy(x,y);
putch(196);
}
for(x=38,y=9;y<18;y++) {
gotoxy(x,y);
putch(179);
}
for(x=71,y=9;y<18;y++)
{
gotoxy(x,y);
putch(179);
}
gotoxy(38,8);
putch(218);
gotoxy(71,8);
putch(191);
gotoxy(38,18);
putch(192);
gotoxy(71,18);
putch(217);
gotoxy(52,8);
cprintf(" SCORE ");
for(x=39,y=9;y<18;x++)
{
gotoxy(x,y);
putch(' ');
if(x==70)
{
x=38;
y++;
}
}
gotoxy(45,10);
t3=(__hour)*60+__min;
t4=__c;
if(t4<0)
t3--,t4=60+t4;
if(t3*60+t4>600)
cprintf(">10 mintes");
el
cprintf("time: %d'%d"",t3,t4);
gotoxy(43,12);
accuracy=right/(right+wrong);
cprintf("Accuracy : %.1f%%",accuracy*100);
gotoxy(45,13);
cprintf("Score : %.0f",right*accuracy*1000/(t3*60+t4));
getch();
for(x=30,y=2;y<24;x++,q++)
{textcolor(7);
textbackground(0);
gotoxy(x,y);
cprintf(" ");
if(x==79)
x=29,y++;
}
gotoxy(30,13);
textcolor(14);
textbackground(0);
cprintf("
gotoxy(18,22);
gotoxy(18,22);
goto XU;
}
el if(k!=0xe08)
{
c[i++]=k;
c[i-1]=c[i-1]&0xff;
gotoxy(x,y);
if(d[i-1]==c[i-1])
{
textcolor(15);
textbackground(0);
right++;
cprintf("%c",c[i-1]);
}
el {
textcolor(12);
textbackground(0);
cprintf("%c",c[i-1]);
wrong++;
}
if(x==79)
x=29,y+=2;
x++;
Get ready ... ... GO! ");
}
el if(k==0xe08)
{
if(i==0)
;
el if(x==30&y==3)
;
el
{
if(x==30)
x=80, y-=2;
x--;
if(c[i-1]==d[i-1])
right--;
el
wrong--;
c[--i]=' ';
gotoxy(x,y);
cprintf("%c",c[i]);
gotoxy(x,y);
}
}
}
getch();
}
本文发布于:2023-12-11 18:58:50,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/zhishi/a/1702292331118510.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:打字程序源代码.doc
本文 PDF 下载地址:打字程序源代码.pdf
留言与评论(共有 0 条评论) |