Question: C++ coding 1. Your first function must greet the user, and ask the user to input two full names (i.e., use getline) and the users

C++ coding

1. Your first function must greet the user, and ask the user to input two full names (i.e., use getline) and the users choice for output effect (use an int). The function will pass all three pieces of data back to the caller of the function. a. In addition, perform input validation in this function to ensure the user enters a valid choice: 1, 2, or 3 and that the input stream does not enter the fail state or cause getline to fail.

2. Your second function will take in the two names, compare their lengths (do count whitespace in the total length), and generate appropriate output based on the users choice. The choices are: 1. Print the longer name diagonally, a. If the names are the same length, print both diagonally. 2. Print the shorter name diagonally, a. If the names are the same length, print both diagonally.

3. Print both names in a vertical column, regardless of length. Tip: you can use setw to achieve the diagonal output by passing an appropriate variable to setw().

4. You may use other functions when appropriate, but only the functions described above are required. Note: you will probably have a number of repeated code segments these are the places you should use functions, if you choose to do so!

5. Design your main function such that it uses the functions above and any supporting code to generate output that matches the examples here (see above and last page).

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!