logical operators

This is a discussion on logical operators within the C++ Programming forums, part of the General Programming Boards category; Why doesn't this work?? Code: do { some code } while ((a==0)&&(b==0)) || ((a==0)&&(c==0))||((c==0)&&(b==0)); I have struggled two hours with ...

  1. #1
    Learn from the llama Marlon's Avatar
    Join Date
    Jun 2005
    Location
    South africa
    Posts
    25

    logical operators

    Why doesn't this work??

    Code:
    do
    {
    some code
    }
    
    while ((a==0)&&(b==0)) || ((a==0)&&(c==0))||((c==0)&&(b==0));
    I have struggled two hours with this and im tired. It keeps on saying expecting ; before ( or something..

    Im probally just daft but i cant see my mistake

    Thanks in advance
    `Who are YOU?' said the Caterpillar.
    This was not an encouraging opening for a conversation. Alice replied, rather shyly, `I--I hardly know, sir, just at present-- at least I know who I WAS when I got up this morning, but I think I must have been changed several times since then.' - Lewis Caroll's Alice in Wonderland.

  2. #2
    /*enjoy*/
    Join Date
    Apr 2004
    Posts
    159
    i have not a compiler but try this ...
    while(((a==0)&&(b==0)) || ((a==0)&&(c==0))||((c==0)&&(b==0)));

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    69
    My guess is
    Code:
    some code;

  4. #4
    Learn from the llama Marlon's Avatar
    Join Date
    Jun 2005
    Location
    South africa
    Posts
    25
    some code is only because i dont feel like typing all the code, ignore it if you want to...
    `Who are YOU?' said the Caterpillar.
    This was not an encouraging opening for a conversation. Alice replied, rather shyly, `I--I hardly know, sir, just at present-- at least I know who I WAS when I got up this morning, but I think I must have been changed several times since then.' - Lewis Caroll's Alice in Wonderland.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    while ((a==0)&&(b==0)) || ((a==0)&&(c==0))||((c==0)&&(b==0));

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Jul 2005
    Location
    Lahore, Pakistan
    Posts
    6
    Just do what enjoy said. i.e
    Code:
    while (((a==0)&&(b==0)) || ((a==0)&&(c==0))||((c==0)&&(b==0)));

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Operators in C++
    By Flecto in forum C++ Programming
    Replies: 4
    Last Post: 05-15-2009, 08:17 AM
  2. Codeblocks and logical operators
    By fhbwghads in forum C++ Programming
    Replies: 2
    Last Post: 12-07-2008, 05:22 AM
  3. Relational and Logical Operators
    By GSLR in forum C Programming
    Replies: 2
    Last Post: 03-03-2002, 04:33 PM
  4. Logical Operators
    By E i F x 65 in forum C++ Programming
    Replies: 6
    Last Post: 01-24-2002, 08:45 AM
  5. logical operators
    By sballew in forum C Programming
    Replies: 4
    Last Post: 09-04-2001, 07:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21