16)YuChuan

code format="cpp"
 * 1) include

using namespace std;

class Stack{ protected: int top; char stack[5]; bool full; bool empty; char chak; public: Stack{ top=0; full=false; empty=true; } char push(char cha){ if(!full){ stack[top]=cha; chak=stack[top]; top++; empty=false; isfull; for (int x=0;x<top;x++){ cout<<stack[x]; }       return chak; }   else{ isfull; cout<<"Stack is full"; return false; } } char pop{ if(!empty){ chak=stack[top-1]; isempty; top--; return chak; }   else{ cout<<"Stack is Empty"; return false; } } bool isempty{ if(top<0){ top=0; empty=true; full=false; return true; }   else{ full=false; return false; } } bool isfull{ if(top==5){ empty=false; full=true; return true; }   else{ full=false; return false; } } };

int main{ Stack first; bool cont3=true; while(cont3){ bool cont1=true; bool cont2=true; int choice; while(cont1){ cout<<"For Help,Enter the corresponding numbers:"<>choice; cout<<endl; switch(choice){ case 1: cout<<"Try removing 6 characters from the stack, and then add new characters."; break; case 2: cout<<"Try adding 4 items to the stack, then push another item."; break; case 3: cout<<"Try adding 5 items to the stack, then push another item."; break; case 4: cout<<"Pushing a character will show the current string, and initiating pop will display the character removed."; break; case 5: cont1=false; break; } cout<>choice; switch(choice){ case 1: cout<<"Enter a character:"; cin>>cha; first.push(cha); break; case 2: cha=first.pop; if(cha){ cout<<"The Character Popped was: "<<cha<<endl; }   break; case 3: cont2=false; cout<<endl; break; case 4: cont3=false; cont2=false; break; } } } }

code