Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Boolean Algebra; Help!

Name: Anonymous 2008-03-06 16:51

#include <iostream>

using namespace std;

int main()

{
   
    float number;
   number = 9;
    if (number == 2 || 3)
    {cout<<"\n\nRight!";}
    else{cout<<"Wrong";}
    cin.get();
   
}


This script (in my understnding) should display "Wrong", it actually displays "Right"

Help?

Name: Anonymous 2008-03-06 18:55

>>13
regardless of what the left side of || is, the right side is 3, which is not 0, and
You mean "regardless of what the *right* side is, if the left side is true, then right side is not evaluated".
faggot.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List