Question
Using stacks, write a program in C++ to check if an expression is correctly parenthesized. In other words, you are checking that every left parenthesis
Using stacks, write a program in C++ to check if an expression is correctly parenthesized. In other words, you are checking that every left parenthesis has a matching right parenthesis. Only check for parentheses and no other characters, i.e., if (2+3)*5 is given as input, the output should be The expression is correctly parenthesized. Given an input 5(3+8, the output should be The expression is not correctly parenthesized.
Write a recursive method called powerof3() that, given an integer n, returns 3n (3 to the nth power). Please remember that 30 = 1, 31 = 3, 32 = (3*3) = 9, 33 = 3*3*3 = 27, etc.
Write a recursive method called capitalize() that will capitalize the letters in a sentence. For example, capitalizing (Old McDonald had a Farm) would give you: OLD MCDONALD HAD A FARM. You cannot use the toupper function to do the capitalization for you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started