Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in C++ 4. Write a program that reads a person's name in the following format: first name, then middle name or initial, and then

image text in transcribed

Write in C++

4. 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_Initia1. 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 the middle initial even if the input did not contain a period. Your program should allow for users who give no middle name or middle initial. In that case, the output, of course, contains no middle name 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 most 20 characters long. Alternatively, use the class string. (Hint: You may want to use three string variables rather than one large string variable for the input. You may find it easier to not use getline.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

Use the limit definition to prove that lim n0

Answered: 1 week ago

Question

1. Speak plainly and briefly, and avoid jargon.

Answered: 1 week ago