19)Han+Cheng

code format="cpp" using namespace std;
 * 1) include

class stack { private: int top; //Index to the next item to POP/PUSH char arr[5]; //Storage for the 5 characters bool full; //Indicates that the STACK already has 5 characters bool empty; //Indicates that there are no items in the STACK

public: //constructor stack { //array is emptym at the start empty = true; full = false; top = -1; }

//destructor ~stack{};

//Checks if STACK is Empty bool isEmpty { return empty; }

//Checks if STACK is Full bool isFull { return full; }

//Adds an item to the TOP of the STACK bool push(char c) { if (!isFull) {//not full top++;//top pointer increases for space to push arr[top] = c;//add char to array if (top == 4) full = true;//if just nice do not allow any other more empty = false;//if there is sth it is not empty cout << "Char '" << c << "' pushed." << endl; return true; } else { cout << "Array full" << endl; return false; }       }

//Removes an item to the TOP of the STACK char pop { char rtnChar; if (!isEmpty) {//not empty rtnChar = arr[top];//get char that is going to be popped arr[top] = '\0';//nullify the top char top--;//top pointer decreases if (top == -1) empty = true;//if empty do not allow any other more } else { cout << "Array empty" << endl; }               return rtnChar; }

};

int main { stack la;

//1)   Removing an item from a STACK  with no items    cout << "Char popped: '" << la.pop << "'" << endl;

la.push('a'); la.push('b'); la.push('c'); la.push('d');

//2)   Adding items to a STACK that has 4 items    la.push('e');

//3)   Adding an item to a STACK that has 5 items    la.push('f');

//4)   Show that the items in the STACK are in LIFO order.    cout << "1st Char popped: '" << la.pop << "'" << endl;    cout << "2nd Char popped: '" << la.pop << "'" << endl;    cout << "3rd Char popped: '" << la.pop << "'" << endl;    cout << "4th Char popped: '" << la.pop << "'" << endl;    cout << "5th Char popped: '" << la.pop << "'" << endl;

system("Pause"); return 0; } code Type in the content of your page here.