Tuesday 15 January 2019

Apply And OR Code in c++

(y OR x) AND z:

#include <iostream>

using namespace std;

int main()
{
    cout<<"x\ty\tz\t(xORy)ANDz"<<endl;
    for(int x=0; x<2; x++)
    {
        for(int y=0; y<2; y++)
        {
            for(int z=0; z<2; z++)
            {
                cout<<x<<"\t"<<y<<"\t"<<z<<"\t"<<((x||y)&&z)<<endl;

            }
        }
    }
    return 0;
}

No comments:

Post a Comment