Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prompts the user for a first name, middle name and last name. Each name string is to be saved in its

Write a program that prompts the user for a first name, middle name and last name. Each name string is to be saved in its own character array. Then create a full name string by copying the first name to a fourth array, and concatenating (which means to append) the middle and last names (be sure when the full name string to separate each name string with some whitespace). Once the full name in its own buffer, display the total number of characters in the full name (not counting the blank space separators; for the sake of simplicity we won't worry about names that have embedded whitespace).

Finally, compare each of the name components to see if any of them are identical, and if they are, display an appropriate message to stdout. Perhaps some sample runs will clarify the expected output:

Run #1

Please enter your first name: Edward Please enter your middle name: Frank Please enter your last name: Edward Your full name is: Edward Frank Edward The total number of characters in your name is: 17 The first and last names are the same.

Run #2

Please enter your first name: Frank Please enter your middle name: Edward Please enter your last name: Edward Your full name is: Frank Edward Edward The total number of characters in your name is: 17 The middle and last names are the same.

Run #3

Please enter your first name: Frank Please enter your middle name: Frank Please enter your last name: Frank Your full name is: Frank Frank Frank The total number of characters in your name is: 15 The first and middle names are the same. The first and last names are the same. The middle and last names are the same.

Run #4

Please enter your first name: Frank Please enter your middle name: Michael Please enter your last name: Edward Your full name is: Frank Michael Edward The total number of characters in your name is: 18

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions