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

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!