Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool election (bool x,bool y,bool z)
- {
- int One=0;
- if (x==1 ) One++;
- if (y==1 ) One++;
- if (z==1 ) One++;
- if (One>1) return true;
- else return false;
- }
- int main()
- {
- bool x,y,z;
- cin>>x>>y>>z;
- cout<<election(x,y,z);
- return 0;
- }
- /* return (1+0+0)
- 1 1 0
- 0 1 1
- 1 0 1
- 1 1 1
- (x | y) & (y | z)
- return ((x | y) & (y | z) )? true:false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement