Write a C++ program prog.cpp along with Stack.h and Stack.cpp. * In Stack.h and
ID: 3634737 • Letter: W
Question
Write a C++ program prog.cpp along with Stack.h and Stack.cpp.* In Stack.h and Stack.cpp, create a stack that stores char data. Doesn’t matter whether you implement static stack or dynamic stack.
* In prog.cpp, write a main function that asks the user to enter a series of parentheses and/or braces, then indicates whether or not they’re properly nested:
Example 1:
Enter parentheses and/or braces: ((){}{()})
Parentheses/braces are nested properly
Example 2:
Enter parentheses and/or braces: {{{()}}
Parentheses/braces are NOT nested properly
The Hint:
As the program reads characters, have it push each left parenthesis or left brace. 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 aren’t nested properly). When there is no more character to read, check if the stack is empty; if so, the parentheses/braces are matched.