Write a program that reads names (from an input file) in the following format (you can assume names are no more than 30 characters if you are using C-string):
First_name Middle_name/Middle_initial Last_name
The program then outputs (to a file) the name in the following format (a period must be place right after the Middle_initial. The first character of First/Middle/Last name must be capitalized):
Last_name, First_name Middle_initial.
The input file name must be "infile" and the output file name must be "outfile". There are unknown number of persons in input files, however, each person's name occupies a line. And each person must have First, Middle/Middle Initial, and Last in the format described above.
Example:
Suppose the input file consists of (special consideration is required for the case "Mary J. Horn"):
Mary J. Horn
John Jerry Doe
Edward David Cain
Then the output file should contain:
Horn, Mary J.
Doe, John J.
Cain, Edward D.