Advertisement
Advertisement
| 06.20.2008 at 10:02PM PDT, ID: 23504200 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: |
#include <iostream>
#include <stack>
using namespace std;
void Menu();
void Add();
void Display();
void Remove();
stack<int> stackInt;
int name;
int main()
{
Menu();
}
void Menu()
{
int choice;
cout << "Stack Menu Options\n";
cout << "1 - Add int to stack\n";
cout << "2 - Remove from top of stack\n";
cout << "3 - Size of stack\n";
cout << "0 - Quit program\n";
cout << "Enter choice: ";
cin >> choice;
cout << endl;
switch(choice)
{
case 1:
Add();
break;
case 2:
Remove();
break;
case 3:
Display();
break;
case 0:
exit(0);
default:
cout << "Not a selection, enter again!\n";
Menu();
break;
}
}
void Add()
{
cout << "Enter a number to add: ";
cin >> name;
stackInt.push(name);
cout << endl;
Menu();
}
void Display()
{
}
void Remove()
{
stackInt.pop();
Menu();
}
|