Hello people!! I have a queue class that works just fine. But I need to have it spit out permutations of A B C. Like A , B, C, AA, AB, AC, BA, BB, BC, ..... CCC. I haven't the vaguest idea how to even get started on this part. My professor said something like print add add put in rear or something like that...but I didn't really understand.
Here's my client class:
Code:
#include <iostream>
#include <string>
#include "queue.h"
int main(void)
{
Queue myLine; //myLine is a new queue object
char userans;
el_t eltoget, eltoadd;
cout << "Enter your choice Q to quit or something else";
cin >> userans;
while((userans != 'Q') && (!myLine.isFull()))
{
cout << "Give me an element to add: ";
cin >> eltoadd;
myLine.add(eltoadd);
cout << "Enter your choice Q to quit or something else";
cin >> userans;
}
cout << "The Line has " << myLine.getSize() << " elements." << endl;
cout << "Now removing and displaying all elements..." << endl;
while(!myLine.isEmpty())
{
myLine.remove(eltoget);
cout << eltoget << endl;
}
system("pause");
return 0;
}
I'm sure some smart person in here has done this type of thing...if you could just steer me in the right direction I could probably handle it from there....
Thanks for any help!