Introduction to C++
Jonah Warrenjonah AT parsons DOT edu
http://www.feedtank.com/2005/cpp
Homework 3
(Please email me if you have any questions.)- Reread Chapter 4. If you haven't read it, READ IT!
- Reread Chapter 5. It wil help with next class.
- Review class code here.
- Create a program that asks the user to think of an acronym thats made up of three
different words. Ask the user to the type in the three words. Use three different character arrays to
store the user input. Print out the resulting acronym. Here is an example output:
Think of an acronym that uses three different words: Type the first word: Most Type the second word: Valuable Type the third word: Player Your acronym is M.V.P.
- Create a program that asks the user to enter in five words. Print out those
five words, then print out a string that is all five words concatenated together. Do this in the
following way:
- To hold the five words, create a dynamic array of string values (using the new keyword, and a pointer).
- Create a string variable that will hold the five words concatenated together.
- Create a string pointer that is initialized to the address of your dynamic array.
- Use your pointer to get at the array values (no bracket notation). For each array spot, you will print it out using your pointer, add it to your concatenated string using your pointer and then increment your pointer to get it pointing to the next spot in the array.
- Delete your dynamic array.
- Zip up questions 4 and 5. Post them to your website.