Matrix_code

Snippets

Feb 13th, 2021 (edited)
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. // Iterate through non-empty proper subsets. Doesn't include mask
  2. for(int a = (mask - 1) & mask; a ; a = (a - 1) & mask){
  3.    printf("%d is a non-empty proper subset of %d", a,n);
  4. }
  5.  
  6. // Iterate through all subsets
  7. for(int a = mask; true ; a = (a - 1) & mask){
  8.    printf("%d is a subset of %d", a,n);
  9.    if(a == 0) break;
  10. }
  11.  
Add Comment
Please, Sign In to add comment