Question: STL Stack Write a C++ program hw6.cpp that does the following: The program first creates an STL stack that stores char data. Then ask user

STL Stack Write a C++ program hw6.cpp that does the following: The program first creates an STL stack that stores char data. Then ask user to enter a series of parentheses and/or braces, then report whether or not theyre properly nested: Example run: Enter parentheses and/or braces: ((){}{()}) Parentheses/braces are nested properly Continue? (y/n) Enter parentheses and/or braces: {{{()}} Parentheses/braces are NOT nested properly Continue? (y/n) Enter parentheses and/or braces: {({{()(){}}))} Parentheses/braces are NOT nested properly Continue? (y/n) After each round, ask user if he/she wants to continue. If yes, go back to the previous step and take another string of parentheses/braces. If no, terminate program. Hint: As the program reads characters, have it push each left parenthesis or left brace into the STL stack. When it reads a right parenthesis or brace, have it pop the stack and check if the popped item is a matching parenthesis or brace (If not, the parentheses/braces arent nested properly). When there is no more character to read, check if the stack is empty; if so, the parentheses/braces are matched. If the user enters any character other than parenthesis or brace, simply ignore it. Therefore, entering a wrong character shouldnt lead to program malfunction. Note: If you implement it without using STL stack, there will be a huge loss of points (even if the program works).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!