PROG+PROB. SOLV W/C++, ENH (SPEC VAL)
PROG+PROB. SOLV W/C++, ENH (SPEC VAL)
6th Edition
ISBN: 9781284564266
Author: Dale
Publisher: Jones & Barlett
bartleby

Videos

Question
Book Icon
Chapter 3, Problem 7PP
Program Plan Intro

Program Plan:

Following variables are used in the program:

name: To store the string name entered by user.

firstName, middleName, lastName: To store the first name, middle name and last name of string name entered by user.

Following functions are used in the program:

Getline(): used to read a string from console.

find(): used to find the index of the first occurrence of the sub-string being called in the specified string.

substr(pos,n): It is a predefined function that returns a copied string for n characters starting with the index pos.

length(): returns the length of string.

cout: used to display output to the console.

Summary Introduction:

Program will use Main () method to ask the user to enter the string name. find() method is used to get the index(i) of the first occurrence of space delimiter then extract the first name(substring) from index 0 to index i of string name using substr() method. Similarly, middle name and last name are extracted and finally print the first name, middle name and last name of string name.

Program Description:

The purpose of the program is to break and print the string name entered by the user in three parts as first name, middle name, and last name.

Blurred answer
Students have asked these similar questions
I need help to resolve the case, thank you
In 32-bit MSAM, You were given the following negative array. write a program that converts each array element to its positive representation. Then add all these array elements and assign them to the dl register. .data    myarr sbyte -5, -6, -7, -4.code     ; Write the rest of the program and paste the fully working code in the space below.   the dl register should have the value 22 after summing up all elements in the array.
Microprocessor 8085 Lab Experiment Experiment No. 3 Logical Instructions Write programs with effects 1. B=(2Dh XOR D/2) - (E AND 2Eh+1) when E=53, D=1Dh 2. HL= (BC+HL) XOR DE (use register pair when necessary), when BC=247, HL 516, DE 12Ach 3. Reset bits 1,4,6 of A and set bits 3,5 when A=03BH Write all as table (address line.hexacode,opcede,operant.comment with flags)
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges; Author: FreecodeCamp.org;https://www.youtube.com/watch?v=oBt53YbR9Kk;License: Standard YouTube License, CC-BY