Escribir el código fuente del juego c
# incluir & lttime.h & gt
char *kw[]={"Q W E R T Y U I O P [ ]",A S D F G H J K L;","Z X C V B N M, .
/ "};
long AllCounter=0, RightCounter=0, contador incorrecto = 0;
Main()
{
int i, j;
int divertido _ Esc();
clr SCR();
gotoxy(18, 1); p>printf("%s\n ",kw[0]);
gotoxy(20,3);
printf("%s\n ",kw[1 ]);
gotoxi(22, 5);
printf("%s\n ", kw[2]); 25);
for(I = 0;i<60;i++)
{
printf(" = ");
}
gotoxy(1, 1);
printf(" todos los canales:% LD \ n correcto:% LD \ n incorrecto:% LD ", AllCounter, RightCounter, contador incorrecto) ;
gotoxy(501);
printf("Presione Esc para salir");
gotoxy(50, 2);
printf("Entrar para pausar");
gotoxy(26, 12);
printf(" * * * * * * * * * * * * * * * ) ;
gotoxy(26,13);
printf("*¡Presiona cualquier tecla para comenzar!*");
gotoxy(26,14);
printf(" * * * * * * * * * * * * * * *);
gotoxy(51, 13);
if( getch()==27)
{
if(fun_Esc()==1)
{
clr SCR() ;
Salir(0);
}
}
gotoxy(23,12);
printf(" ");
gotoxy(23,13);
printf(" ");
gotoxy(23,14);
printf(" ");
mientras(1)
fun _ Play();
}
int fun_Play()
{
int x, y, I, j;
Temporizador entero sin signo
char ch
Carácter doblado;
time _ t t
srand((unsigned)time(&t));
gotoxy(26, 12);
printf(" ");
gotoxy(26,13);
printf(" ");
gotoxy(26, 14);
printf(" ");
y = 6;
temporizador = 100000;
I = rand() % 3;
j = rand()%(9-I);
ch = kw[I][j * 4];
x = 18+I * 2+j * 4;
mientras(y & lt;=24)
{
if(kbhit() )
{
>cur = getch();
if(cur==ch || cur==ch+32)
{
ch = ' *temporizador = 1000;
}
si no(cur==27)
{
if(fun_Esc()==1)
{
clr SCR();
Salir(0);
}
} p >
else if(cur=='\r ')
{
gotoxy(x, y-1);
printf(" " );
gotoxy(26,12);
printf(" * * * * * * * * * * * * * ");
gotoxy (26, 13);
printf("*Presione cualquier tecla para continuar* ");
gotoxy(26, 14); * * * * * * * * * * * * * ");
getch();
gotoxy(28, 13);
printf( " ");
}
Otros
{
contador incorrecto++;
}
}
Si (y & gt6)
{
gotoxy(x, y-1);
printf( " ");
}
gotoxy(x, y);
printf("%c ", ch);
gotoxy(1, 1);
printf(" todos los canales:% LD \ n correcto:% LD \ n incorrecto:% LD ", AllCounter, RightCounter, contador incorrecto);
Retraso (temporizador);
y++;
}
todos los contadores++;
if(ch == '* ' )
{
contador derecho++;
}
}
int fun_Esc()
{
int key = ' #
gotoxy(26, 12);
printf(" * * * * * * * * * * * * * * * * *);
gotoxy(26,13);
printf("*¿Estás seguro de que quieres salir? (S/N)* ";
gotoxy(26,14);
printf(" * * * * * * * * * * * * * * * * *) ;
gotoxy(51,13);
Y (key!= ' Y ' & amp& amp key! = ' y ' & amp& amp key! = ' N ' & amp& clave de amplificador ='n ')
{
clave = getch();
if(clave=='Y' || clave==' y ')
{
Devuelve 1;
}
if(key=='N' || key==' n ')
{
gotoxi(24,12);
printf(" ");
gotoxi(24,13 );
printf(" ");
gotoxy(24,1
4);
printf(" ");
Devuelve 0;
}
}
}