Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

complete the program according to the guide. thank you String Processing Objective: Learn how to - using string functions -- format output Problem: Write a

complete the program according to the guide. thank you image text in transcribed
image text in transcribed
image text in transcribed
String Processing Objective: Learn how to - using string functions -- format output Problem: Write a program that repeatedly prompts the user to enter one line of a full name, each consisting of a first name, one or more middle names, and a last name, in that order, from keyboard. Then output the full name to the screen in the following format: the last name followed by a comma and then the first name; if the input full name includes one middle name, then output the middle name. If the input name has no middle name, then output NAN for middle name. You can assume that the user would not input more than three words. For example, if you enter John Henry Doe, the output should be Last name First name Middle name Doe, John Henry Requirements: Your program will quit if you input exit and will handle errors if you input nothing or only one word. You must use strepy_s() function to copy one string to the other and use strtok_s() to separate tokens. Suggested screen design: Enter your full name (exit to end): John Henry Doe Last name First name Middle name Doe, John Henry Enter your full name (exit to end): George Chen Last name First name Middle name Chen, George NAN Enter your full name (exit to end): You didn't input your name! Try again Enter your full name (exit to end) : Chen You need to enter your full name. Try again Enter your full name text to end : Donald Wacky Mouck Lastrame First name Middle name McDok, Donald Hacks Enter your full name exit to na Goodbye #include using namespace std; #include using std::setw; #include int main() { DECLARATION OF VARIABLES while (1) // use break to terminate the while loop { cout

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

Step: 3

blur-text-image

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 Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Question What is a secular trust?

Answered: 1 week ago