Advertisement
SergeyPGUTI

6.1.4

Oct 24th, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  bool election (bool x,bool y,bool z)
  6. {
  7.     int One=0;
  8.     if (x==1 ) One++;
  9.     if (y==1 ) One++;
  10.     if (z==1 ) One++;
  11.  
  12.     if (One>1) return true;
  13.         else return false;
  14. }
  15. int main()
  16. {
  17.     bool x,y,z;
  18.     cin>>x>>y>>z;
  19.     cout<<election(x,y,z);
  20.     return 0;
  21. }
  22.  
  23. /* return (1+0+0)
  24.  1 1 0
  25.  0 1 1
  26.  1 0 1
  27.  1 1 1  
  28.  (x | y) & (y | z)
  29.   return ((x | y) & (y | z) )? true:false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement