Power set

I am trying to do a compute and output a power set program. The numbers will be input through a file. I have no idea how to do a power set. Here is my code
#include <iostream>
#include <fstream>
#include <string>
#include <ostream>
using namespace std;

int main ()
string array[21]; // creates array to hold names
int loop=0; //short for loop for input
string line; //this will contain the data read from the file
ifstream myfile ("sets.txt"); //opening the file.
if (myfile.is_open()) //if the file is open
while (! myfile.eof() ) //while the end of file is NOT reached
getline (myfile,line); //get one line from the file
array[loop] = line;
myfile.close(); //closing the file
else cout << "Unable to open file\n"; //if the file is not open output
int input= 0;
cout <<"Please select one of the following option\n"<< endl;
cout<<"[1] Compute and Output Power Set\n";
cout<<"[2] Compute Set Cardinality\n";
cout<<"[3] Compute Power Set Cardinality\n";
cout<<"[4] Quit\n";
cin >> input;
if (input == '1'||'2'||'3')

while(input != 4);
return 0;
have no idea how to do a power set.


It isn't so bad, it's just like counting in binary.
Topic archived. No new replies allowed.