Computer Science Canada If Statements |
Author: | sockoo [ Sun Oct 01, 2006 12:22 pm ] | ||
Post subject: | If Statements | ||
Well first off i'd like to introduce my self and say that .. i'v just started to learn C ++ and obviously sense im here i need a bit of guidence
In the program just listed i want to be able to recieve a value from the user and then decide wiether or not the value is any of the if statements. But it doesnt seem to work , where am i going wrong ? |
Author: | Tony [ Sun Oct 01, 2006 12:28 pm ] |
Post subject: | Re: If Statements |
sockoo wrote: if (value <100);
the semicolon ; terminates the statement |
Author: | wtd [ Sun Oct 01, 2006 12:35 pm ] |
Post subject: | |
A suggestion on how to avoid this kind of confusion: Just because you don't always have to use the braces, that does not mean you shouldn't use them. |
Author: | md [ Sun Oct 01, 2006 4:30 pm ] |
Post subject: | |
Or, if you don't use braces at the very least use proper formating. Indenting the code to be executed if the condition is true helps make it more obvious what things are. |
: |