Acasa Tehnologie Simularea unui contor

Simularea unui contor

by Dragos Schiopu

>

#include <conio.h>
#include <stdio.h>
#include <dos.h>

void main(void)
{
int contor=0,pas;
char stare='o';
clrscr();
printf("Comenzi: n S-Start n O-Stop n R-Reset n E-Exit");
gotoxy(38,12);
cprintf("%05d",contor);

while(stare!='e')
{
delay(10);
if(stare=='s') pas=1;
else if (stare=='0') pas=0;
else if(stare=='r')
{ pas=0;
contor=0;
}
contor=contor+pas;
gotoxy(38,12);
cprintf("%05d",contor);
if (kbhit())stare=getch();
}
}

s-ar putea sa-ti placa