Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that reads a person\'s name in the followingformat: first name,

ID: 3616750 • Letter: W

Question

Write a program that reads a person's name in the followingformat: first name, then middle name or initial, and then lastname. The program then outputs the name in the followingformat:
Last_Name, First_Name Middle_Initial.
For example, the input
Mary Average User
should produce the output:
User, Mary A.
The input
Mary A. User
should also produce the output:
User, Mary A.
Your program should work the same and place a period after themiddle initial even if the input did not contain a period. Yourprogram should allow for users who give no middle name or middleinitial. In that case, the output, of course, contains no middlename or initial. For example, the input
Mary User
should produce the output
User, Mary
If you are using C strings, assume that each name is at most20 characters long. Alternatively, use the class string. Hint: Youmay want to use three string variables rather than one large stringvariable for the input. You may find it easier to not usegetline. Write a program that reads a person's name in the followingformat: first name, then middle name or initial, and then lastname. The program then outputs the name in the followingformat:
Last_Name, First_Name Middle_Initial.
For example, the input
Mary Average User
should produce the output:
User, Mary A.
The input
Mary A. User
should also produce the output:
User, Mary A.
Your program should work the same and place a period after themiddle initial even if the input did not contain a period. Yourprogram should allow for users who give no middle name or middleinitial. In that case, the output, of course, contains no middlename or initial. For example, the input
Mary User
should produce the output
User, Mary
If you are using C strings, assume that each name is at most20 characters long. Alternatively, use the class string. Hint: Youmay want to use three string variables rather than one large stringvariable for the input. You may find it easier to not usegetline.

Explanation / Answer

please rate - thanks #include #include #include using namespace std; int main() {char input[75],first[20],middle[3],last[20]; int i=0,j=0,k=0; bool midfound; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote