Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are to write a program that prompts the user for their full name. However, the user can enter only their first name, or first
You are to write a program that prompts the user for their full name. However, the user can enter only their first name, or first and last name, or first, middle, and last name. Your objective is read the entire name that is given at once (using the getline function) and be able to extract the first, middle, and last name appropriately given that there is whitespace in between. Then you'll display on the screen what their first, middle, and last name are if all the names are given with the total length of their full name (without white spaces). For simplicity, we will assume that a person can have a max of 3 names (first, middle, and last). As a note, each name string is to be saved in its own character array. NOTE: Each character array should have appended to it a null terminator ('10') at the end of it. Below are some sample runs: Run #1 Please enter your full nane: Edgar First nane: Edgar The total number of characters in your nane is: s Run W2 Please enter your full nane: Edgar Allen First Nane: Edgan Last Nane: Allen The total number of characters in your nane is: 10 Run A3 Please enter your full nane: Edgar Allen Poe First Nane: Edgar Middle Nane: Allen Last Name: Poe The total number of characters in your nane is: 13
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started