Write a C++ program that does the following: - input a name in a single variable
ID: 3642317 • Letter: W
Question
Write a C++ program that does the following:- input a name in a single variable in this order: first name middle initial last name.
- find the first name and store it in a separate string variable. Display the last name substring along with its length.
- find the middle initial and store it in a separate string variable.
- find the last name and store it in a separate string variable. Display the last name substring along with its length.
- display the length of the concatenated string.
- find and display the position of the comma in the concatenated string.
- swap the first name and last name strings. Display the names after they are swapped.
The output should resemble the following:
- Enter a first name, middle initial, last name: Katherine G Mills
- The 9 characters of the first name are: Katherine
- The 5 characters of the last name are: Mills
- In the phone book, the name would be: Mills, Katherine G
- The length of the name is: 18
- The comma is at position: 5
- After the swap, the last name is Katherine and the first name is Mills
Explanation / Answer
Try this... string fullName = ""; string firstName = ""; string middleInitial = ""; string lastName = ""; cout > fullName; int level = 0; for(int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.