Advertisement
trentk3660

shows all possible boolean outputs for 1 or 2 inputs

Sep 23rd, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1.     // how to generalize this?? one function for n inputs
  2.     void showOutsFor2(){
  3.         cout << "all possible combinations for two outupts" << endl;
  4.         cout << "A\t|\tB " << endl;
  5.         cout << "---------" << endl;
  6.        
  7.         for(int i = 0 ; i < 2; i++)
  8.             for(int j = 0; j < 2; j ++)
  9.                 cout << i << "\t \t" << j << endl;
  10.     }
  11.     void showOutsFor3(){
  12.         cout << "all possible combinations for three outupts" << endl;
  13.         cout << "A\t|\tB\t|\tC" << endl;
  14.         cout << "------------------" << endl;
  15.        
  16.         for(int i = 0 ; i < 2; i++)
  17.             for(int j = 0; j < 2; j ++)
  18.                 for(int k = 0; k < 2; k++)
  19.                     cout << i << "\t \t" << j << "\t \t" << k << endl;
  20.        
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement