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 thefollowing format: first name, t

ID: 3608096 • Letter: W

Question

Write a program that reads a person’s name in thefollowing format: first name, then middle name or initial, and thenlast name. 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 string, assume that each name is at most 20characters 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 first[20],middle[20],last[20],name[75]; int i=0,j=0,k=0; for(i=0;i