Advertisement
alin991

Untitled

Aug 29th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int N =3, subm[25];
  5. void gen(int element, int lgSubm) {
  6.   if (element == N + 1) {
  7.     for (int i = 0; i < lgSubm; ++i)
  8.       cout<<subm[i]<<' ';
  9.     cout<<"\n";
  10.     return;
  11.   }
  12.   subm[lgSubm] = element;
  13.   gen(element + 1, lgSubm + 1);
  14.   gen(element + 1, lgSubm);
  15. }
  16. int main(){
  17. gen(1,0);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement