I need to create a C program that goes like this:
The user wil enter the number of seconds that the stopwatch should run starting at the equivalent time in hours, minutes and seconds of the input. The stopwatch runs until the time becomes 00:00:00.
I don't want you guys to do the whole thing for me, since this is clearly a homework.
Just some hints please?
I've done some experiments but there are still some problems.
Thanks for your time! ^__^
Here's what I've done so far:
#include<stdio.h>
#include<conio.h>
void gotoxy();
main()
{
int a,b,c,d,e,f,sec,ctr;
a=b=c=d=e=f=ctr=0;
clrscr();
printf("Enter seconds:");
scanf("%d",&sec);
clrscr();
while(ctr<sec){
ctr++;
clrscr();
wherex();
gotoxy(33,12);
printf("%d%d : %d%d : %d%d",f,e,d,c,b,a);
a++;
if(a==10){
b++;
a=0;
}
if(b==6){
c++;
b=0;
}
if(c==10){
d++;
c=0;
}
if(d==6){
e++;
d=0;
}
if(e==10){
f++;
e=0;
}
}
while(ctr>=0){
ctr--;
clrscr();
gotoxy(33,12);
printf("%d%d : %d%d : %d%d",f,e,d,c,b,a);
if(ctr=sec-1){
if(a==0)
a=10;
if(b==0)
b=6;
if(
else if(a==0){
b--;
a=10;
}
else if(b==1){
c--;
b=6;
}
else if(c==1){
d--;
c=10;
}
else if(d==1){
e--;
d=6;
}
else if(e==1){
f--;
e=10;
}
a--;
sleep(1);
}
getch();
}