code question

Feb 5, 2010 at 6:49pm
what line of code would i use if i for example have specified what my program does with an "if...blah blah do this" and now i want "if...anything else *error messege*

basically-there are prerequisite inputs, and if anything else is typed in error msg...

does anyone know what i am talking about?

what line of code would that "if anything else" would be?
Last edited on Feb 5, 2010 at 6:49pm
Feb 5, 2010 at 6:50pm
closed account (j3bk4iN6)
exceptions. try, throw , catch
Feb 5, 2010 at 6:52pm
damn...more advanced stuff i havent yet gone into allright thanks, was hoping it would be as simple as if (anything else) lol...
Feb 5, 2010 at 6:53pm
closed account (j3bk4iN6)
there's
if()
else if()
else if()
else
Last edited on Feb 5, 2010 at 6:53pm
Feb 5, 2010 at 7:09pm
To be less confusing, you probably want to use

1
2
3
4
5
6
7
8
9
    if (<statement>) {
        <code>;
    }
    else if (<statement>) {
        <code>;
    ...
    else {                              //This is the statement you want, it will be an everything "else"  
        <code>;                         //condition
    }


Last edited on Feb 5, 2010 at 7:10pm
Feb 5, 2010 at 7:12pm
closed account (j3bk4iN6)
http://www.cplusplus.com/doc/tutorial/operators/
Feb 5, 2010 at 7:14pm
oh thats right....else and if are not the same thing....hah...i still havent even learned that stuff totally well soz for being a newbie
Feb 5, 2010 at 7:14pm
closed account (j3bk4iN6)
I'm sorry I was obscure, I was in a rush.
Topic archived. No new replies allowed.