![]()
The program stars.cpp prints a line of stars both iteratively and recursively. Examine this file, then compile and run it.
Make the following changes to stars.cpp.
cout << n << " ";
Discuss what will happen, then compile and run.
Examine the program mystery.cpp and discuss what it should do. Compile and
run it.
Write a program called parens.cpp that reads a file line by line and indicates whether the parentheses on each line match up (a right parenthesis for each left parenthesis which appears to the right of the left parenthesis). Note that a line can contain an arithmetic expression, symbols other than "(" and ")" are to be ignored, the focus is on whether or not the parentheses match correctly.
Here is a sample run using the data file parens.in
()()()()()() matches! (((((()))))) matches! ()(((())))() matches! ( is missing a right parenthesis. ) is missing a left parenthesis. ((()(())) is missing a right parenthesis. (()(()))) is missing a left parenthesis. ())()( is missing a left parenthesis. (((((((((((((((()))))))))))))))) matches!
You will need to complete the function checkParens. It must be a
recursive function.
Write a program called stutter.cpp that reads a list of words from a file and for each word prints the word with each letter appearing twice.
Here is a sample run using the data file stutter.in
hello = hheelllloo computer = ccoommppuutteerr Halloween = HHaalllloowweeeenn ghost = gghhoosstt
You will need to complete the function stutter. It must be a
recursive function.
Here is a sample run using the data file commas.in
1000 = 1,000 1000000 = 1,000,000 29 = 29 999999 = 999,999 2121212121 = 2,121,212,121
You will need to complete the function printWithCommas. It must be a
recursive function.
![]()