c first name then middle name or initial and then last name

Lab Description

Write a program that reads a person’s name in the following format:

first name, then middle name or initial, and then last name.

The program then outputs the name in the following format:

Last_Name, First_Name Middle_Initial.

Your program will:

  1. Add a period after the middle initial
  2. Allow for users to give no middle name or middle initial
  3. Capitalized the name properly

Expected Conversions/Test Cases

Taco Bell Lui -> Lui, Taco B. 
taco Bell lui -> Lui, Taco B.
taco Lui -> Lui, Taco
taCO BELL lui -> Lui, Taco B.
taco b. LUI -> Lui, Taco B.


  1. Your program will ask user for name input.
  2. Implement at least one function.
  3. Loop to check if user wants to stop the program.
  4. Comments for all functions (including main()) will follow the format as per stated in module 5.