### Timer and other problems...

Pages: 12
maybe you should listen to coder777 and me and use seconds and a for loop.
if you still want to print the minutes and hours, you can use the modulo operator "%"
Im sorry... i do not know anything about anything of what you said.... still learnin'
look at this:
 ``12345678910111213141516171819202122232425262728293031323334`` ``````int amount_sec = 0; if (secminhour=="seconds") { amount_sec = amount; } else if (secminhour=="minutes") { amount_sec = amount * 60; } else if (secminhour=="hours") { amount_sec = amount * 60 * 60; } else { cout<<"ERROR!"; } for(int i = 0; i < amount_sec; ++i) { cout<
what excactly do you not understand?

maybe this helps you http://www.cplusplus.com/doc/tutorial/control/

scroll down till you reach loops
Last edited on
What i do not understand:
for loop
modulo operator %

i give up... ill take an easier task...
you do not need the modulo operator %

the for loop can be expressed as a while loop:
This
`for(int i = 0; i < amount_sec; ++i)`

can be replaced with this:
 ``123456`` ``````int sec = 0; while( sec < amount_sec) { ... sec = sec + 1; }``````

As you can see: the for loop is just a convenient syntax

 i give up
if you give up that quick you won't get far...
Last edited on
if you have problems with the loops. try to set up an 10 elements array and print each element with a for, a while and a do while loop.
it will give you an idea how to change them to receive the same result.

the mudulo operator returns the rest of an integer division
so 5 % 2 is 1, since 5 - (2*2) = 1
the problem is, im 13 years old and my native language is not english so im having problems learning stuff in english...
Topic archived. No new replies allowed.
Pages: 12