#inc <10stream> #include using namespace std; int main() { cout<<"Enter your full name: "; string name; // Use the correct form of input cin >> name; cout << "Hello, + name + "!" << endl;
#inc <10stream> #include using namespace std; int main() { cout<<"Enter your full name: "; string name; // Use the correct form of input cin >> name; cout << "Hello, + name + "!" << endl;
Chapter2: Using Data
Section: Chapter Questions
Problem 16RQ
Related questions
Question
Need Help with this C++ code, it's supposed to only output the first name of any size string

Transcribed Image Text:1 #include <iostream>
2 #include <string>
3 using namespace std;
4
5
6
7
8
9
10
11
12
int main()
{
}
CodeCheck
cout << "Enter your full name:
string name;
// Use the correct form of input
cin >> name;
11
cout << "Hello, + name + "!" << endl;
Reset
Testing main.cpp
Test 1
Input:
Jack None Reacher
Actual
Expected
Enter your full name: Hello, Jack! Enter your full name: Hello, Jack None Reacher!
Expert Solution

Step 1
It can easily be implemented , whenever we encounter " " , we print the first name , below is the sample code and Output attached.
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
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.Recommended textbooks for you

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning