[prog] Re: more C++

Kathryn Andersen kat_lists at katspace.com
Sun Dec 14 10:43:10 EST 2003


On Sat, Dec 13, 2003 at 04:27:01PM -0500, wolf wrote:
> Thanks for the help : )
> 
> Okay so this is what I have now except I receive a message that there 
> is a parsing error before else, I'm not sure what I'm missing
> I've tried taking the { and } out but I thought if there was an if 
> statement you needed the braces. Is it a little error I'm making that
> I just don't seem to see? Or am I way off track?

The braces, if you have them, should be enclosing the statement(s)
between the "if" and the "else".  And likewise braces should (if you
want them) enclose the statement(s) following the else which you want to
be covered by the else.

Braces *are* optional in C, but it's better to use them all the time.

And, yes, you do have a real problem with your "else".  Remember,
normally you have

if (condition)
        statement
else
        statement

Now look at what you have...

-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe


More information about the Programming mailing list