#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int n,m;
void perm(int, int, int, int[]);
int *array;
cout << "Enter the size of the set: ";
cin >> n;
cout << "Enter the size of the subsets: ";
cin >> m;
if (n<1)
{
cout << "Your set cannot be less than 1 element. Program terminated";
return 1;
}
if (n<m)
{
cout << "Your subset cannot be larger than your set. Program terminated.";
return 1;
}
array=new int[n];
perm(0,n,m,array);
}
void perm(int n, int max_size, int sub, int arr[ ])
{
int i,j;
if(n==max_size)
{
for (i=0; i<max_size; i++) cout<<arr[i];
cout<<endl;
return;
}
//for (j=0; j<sub; j++)
//{
arr[n]=0;
perm(n+1,max_size,sub,arr);
//}
arr[n]=1;
perm(n+1,max_size,sub,arr);
}