hmm, float it just supports decimal places. it will still appear as 0.Originally posted by jay_rocks:wow.. it's diff.
this is what i did so far.
#include
void main(void)
{ float hrs, min, sec,count;
char q;
hrs = 0;
min = 0;
sec = 0;
if(hrs>23)
{ hr = 0;
}
else
{hrs = hrs +1;}
if(min>59)
{ min = 0;
}
else
{min = min +1;}
if(sec>59)
{ sec = 0;
}
else
{sec = sec + 1;}
}
not sure how to let it count by itself,start and stop counting and then do smth like hrs:min:secOriginally posted by dumbdumb!:hmm, float it appears as 0.0 right?
i think should use integer.
or u should create like hr1 and h2, m1, m2, s1 s2
so u can have like
s2 while loop s2++, then when it goes more than 9, s1++, and so on and so forth.
anyone got better idea?
hmm in the while loop just put ++Originally posted by jay_rocks:not sure how to let it count by itself,start and stop counting and then do smth like hrs:min:sec
need iostream oso.Originally posted by maurizio13:don't need other header files meh?
only stdio.h?
hmmm
post ur code here and maybe we can help uOriginally posted by jay_rocks:hmm, really stuck. no idea how to go on.
still the same problem. no idea what to do for the whileloop, how to make it stop and starts and oso count.Originally posted by EarlNeo:post ur code here and maybe we can help u
Originally posted by jay_rocks:of coz, cant work... because
still the same problem. no idea what to do for the whileloop, how to make it stop and starts and oso count.
some things i've added, then stuck.
#include
void main(void)
{ float hrs, min, sec,count;
char q,[b]choice;
printf("1.Press 1 to start\n");
scanf("%c",&choice);
hrs = 0;
min = 0;
sec = 0;
count = 0;
while ( )
{ count = count + 1;
if(hrs>23)
{ hr = 0;
}
else
{hrs = hrs +1;}
if(min>59)
{ min = 0;
}
else
{min = min +1;}
if(sec>59)
{ sec = 0;
}
else
{sec = sec + 1;}
printf("%d hr: %d min: %d sec",hrs, min,sec);
}
[/b]
{
continue;
}
}
if (check==p)
{
cout<}
else
{
cout<}
}while(s!=1);
getch();
}
Source: http://www.dreamincode.net/code/snippet1085.htm