My bad, I should think before I post :o
May be something like this should work:
int StackItem1;
long StackItem2;
float StackItem3;
char StackItem4;
while (1)//begin main while
{
int mainMenuChoice; //variable for stack type
cout<<"which stack would you like to create?"<<endl;
cout<<"1: int\t2: long\n3: float\t4: char"<<endl;
cout<<"5: quit"<<endl;
cout<<"(choose 1-5)\n\n"<<endl;
cin>>mainMenuChoice;
switch(mainMenuChoice)
{
case 1:
Stack<int, MaxStack>* stackClassDriver = new Stack<int, MaxStack>;
break;
case 2:
Stack<long, MaxStack>* stackClassDriver = new Stack<long, MaxStack>;
break;
case 3:
Stack<float, MaxStack>* stackClassDriver = new Stack<float, MaxStack>;
break;
case 4:
Stack<char, MaxStack>* stackClassDriver = new Stack<char, MaxStack>;
break;
case 5:
return 0;
default:
cout<<"invalid selection...\n\n"<<endl;
continue;
}
done=false;
while (!done)
{
int stackOperation;
cout<<"1:\tpush\t2:\tpop"<<endl;
cout<<"3:\tprint\t4:\tmain menu"<<endl;
cout<<"(choose 1-4)\n\n"<<endl;
cin>>stackOperation;
switch(stackOperation)
{
case 1:
cout << "Enter stackItem to push: ";
cin >> stackItem;
switch(mainMenuChoice)
{
case 1:
stackClassDriver->push(StackItem1);
break;
case 2:
stackClassDriver->push(StackItem2);
break;
case 3:
stackClassDriver->push(StackItem3);
break;
case 4:
stackClassDriver->push(StackItem4);
break;
}
case 2:
stackClassDriver->pop();
break;
case 3:
stackClassDriver->print();
break;
case 4:
delete stackClassDriver;
stackClassDriver = 0;
done=true;
break;
default:
cout<<"invalid selection...\n\n"<<endl;
continue;
}
}//end while
} Edit: The Dark's suggestion is still better.