Noob question about C++ Created 16 years ago2007-10-19 09:55:48 UTC by Spike Spike

Created 16 years ago2007-10-19 09:55:48 UTC by Spike Spike

Posted 16 years ago2007-10-19 09:55:48 UTC Post #236657
Im doing some noob homework for university, and I have a noob question.

else if (s ==59) s = 0, m++ ;

It is correct to write this?
Posted 16 years ago2007-10-19 09:59:33 UTC Post #236658
I've never written or worked with C++, but needs {}? I.e. should be
else if (s == 59) {
s = 0;
m++; }
Posted 16 years ago2007-10-19 10:02:18 UTC Post #236659
ZombieLoffe is right, but
else if (s == 59) s = 0; m++;
would work too.
ChickenFist ChickenFist<Witty Title>
Posted 16 years ago2007-10-19 10:13:37 UTC Post #236660
Ok thnx, my teachers prefer to write it all on a line (if it is not too large). Thnx
Posted 16 years ago2007-10-19 10:51:18 UTC Post #236662
Another noob question :zonked:

i = i-1; can be write as i--?
Posted 16 years ago2007-10-19 13:19:06 UTC Post #236665
Yup.
Same with i++ instead of i = i + 1;

You can also use i += 10 instead of i = i + 10;
Daubster DaubsterVault Dweller
Posted 16 years ago2007-10-19 14:52:06 UTC Post #236670
Thnx :)
You must be logged in to post a response.