Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya 345154.2174782.qx3zqy7 1 #include 2 #include 3 using namespace std; 4 5 int main() { string firstName; string lastName; 6. 7 8 9. V* Your solution goes here */ 10 11 return 0; 12 }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter3: Input/output
Section: Chapter Questions
Problem 12SA: 12. What is the output of the following program? (2, 3, 6, 8) #include <iostream> #include...
icon
Related questions
Question
CHALLENGE
2.15.1: Reading and outputting strings.
Feedback
ACTIVITY
Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single
words. Then the program outputs last name, first name. End with newline.
Example output if the input is: Maya Jones
Jones, Maya
345154.2174782.qx3zqy7
1 #include <iostream>
2 #include <string>
3 using namespace std;
THE
4
5 int main() {
string firstName;
string lastName;
8.
6.
* Your solution goes here
10
11
return 0;
12 }
MacBook PrO
Transcribed Image Text:CHALLENGE 2.15.1: Reading and outputting strings. Feedback ACTIVITY Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya 345154.2174782.qx3zqy7 1 #include <iostream> 2 #include <string> 3 using namespace std; THE 4 5 int main() { string firstName; string lastName; 8. 6. * Your solution goes here 10 11 return 0; 12 } MacBook PrO
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning