TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FRANK MASINGILL
from: PETER HAYWOOD
date: 1998-03-13 01:12:00
subject: Re: Boolean logic

Groovy hepcat Frank Masingill jived with All on 13 Feb 98  05:23:26!
Boolean logic's a cool scene. Dig it!
 FM> Something's obviously wrong with the program below.  You
 FM> programmers can, I'm sure figure what I'm trying to learn.  Will you
 FM> straighten it up for me? Thanks.
  I can only make assumtions as to what the problem is, since you
neglected to mention.
 FM> #include 
 FM> #include 
 FM> int main()
 FM> {
 FM>   clrscr();
 FM>   int IWantTo, IDontWantTo;
 FM>   WantTo = 0; IDontWantTo = 1;
 FM>   cout << IDontWantTo << endl;
 FM>   if(IWantTo)
 FM>   {
 FM>     cout << IWantTo << endl;
 FM>     return IWantTo;
 FM>   }
 FM>   else
 FM>   if(IDontWantTo)
 FM>   {
 FM>     cout << IDontWantTo << endl;
 FM>     return IDontWantTo;
 FM>   }
  What if neither of these if statements evaluate true? Then there is
no return statement executed. Of course, we know the second will
evaluate true, but the compiler doesn't know that. So you have to put
its little electronic mind at rest and insert a return statement. Add
a return statement here at the end of the main() function:
       return 0;
 FM> }
                                                  Wolvaen
... Fatal Error: User Executed.
  P.S.: Sorry for late reply.
--- Blue Wave/RA v2.20
---------------
* Origin: The Gate, Melbourne Australia, +61-3-9809-5097 33.6k (3:633/159)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.