TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FRANK MASINGILL
from: FREDERIK RETSEMA
date: 1998-02-15 22:47:00
subject: Boolean logic

Hi Frank,
Some comments:
FM> #include 
FM> #include 
FM> int main()
FM> {
FM>    clrscr();
FM>    int IWantTo, IDontWantTo;
       int WhatDoIWant;
FM>    IWantTo = 0; IDontWantTo = 1;
It can, but it's far more easy not to bother with the compilers logic:
       IWantTo = (1==1); IDontWantTo = (1!=1);
The rest is a little bit guessing what you want, but if you want to let the 
user enter a 1 or a 0 and do something with that 0 or with that 1, you might 
do the following:
       while (1 == 1)           // wait forever for a 0 or a 1
       {
           cout << "Type if you want and then press enter:" << endl;
           cout << IWantTo     << " - I want" << endl;
           cout << IDontWantTo << " - I don't want" << endl;
           cin >> WhatDoIWant;
           cout << WhatDoIWant << endl;
           if(WhatDoIWant == IWantTo)
FM>        {
                cout << "IWantTo" << endl;
FM>             return IWantTo;
FM>        }
FM>        else
           if(WhatDoIWant == IDontWantTo)
FM>        {
              cout << "IDontWantTo" << endl;
FM>           return IDontWantTo;
FM>        }
           else
           {
               cout << "Say more clearly what you want !" << endl << endl;
           }
       }
FM> }
Is this something you wanted ?
Bye,
Frederik
--- FMail 1.02/Golded 2.50B
---------------
* Origin: Press 0 for yes, press 1 for no (2:280/905.1)

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™.