I'm having some problems figuring out how to do this. I dont know how to use bit masking techniques. Ive tried everything i could and i went back to what i originally had as code so you guys could possibly help me out.

Also, i have figured out a way to do it if i initialize the array with the full set, but he said that this is not accepted. You must generate a set after an integer is given.

What i have thus far(it prints off every set for 3 but 2 of them):

int main(){ int* set = NULL; //Initializes a dynamically allocated array, allowing user input to set size. int NUM; //The natural integer number that will determine size of array. cout << "Enter any natural integer: "; cin >> NUM; cout << endl << endl; set = new int [NUM]; cout << "All possible subsets for " << NUM << ": " << endl; for(int i = 1; i <= NUM; i++) //Prints off the original single-digit subset { set[i] = i; cout << "{ " << set[i] << " }" << endl; } for( int i = 0; i <= NUM+1; i++ ) { cout << "{ "; for( int j = 0; j < NUM+1; j++ ) { if( (i < j)) { cout << set[j] << " "; } } cout << "}" << endl; } return 0; } //End of Main

Thanks!