#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <time.h>
int main ()
{
char ch;
time_t timer1, timer2;
double segundos_transcurridos = 1.0;
clrscr ();
time (&timer1);
gotoxy (1, 1);
printf ("Presiona la letra 'q' para salir...");
gotoxy (1, 10);
printf ("Digito presionado:");
gotoxy (1, 20);
printf ("Segundos transcurridos:");
while (1) {
if (kbhit ())
if ((ch = getch ()) == 'q')
break;
else if (isdigit (ch)) {
gotoxy (19, 10);
printf ("%c", ch);
}
if (difftime (time (&timer2), timer1) > segundos_transcurridos) {
gotoxy (25, 20);
printf ("%2.g", segundos_transcurridos);
segundos_transcurridos++;
}
}
return EXIT_SUCCESS;
}