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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question
CHALLENGE
Feedback?
ACTIVITY
2.15.1: Reading and outputting strings.
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.qx3zay7
1 #include <iostream>
2 #include <string>
3 using namespace std3;
4
5 int main) {
string firstName;
string lastName;
6.
9.
10
11
return 0;
12 }
MacBook Pro
Transcribed Image Text:CHALLENGE Feedback? ACTIVITY 2.15.1: Reading and outputting strings. 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.qx3zay7 1 #include <iostream> 2 #include <string> 3 using namespace std3; 4 5 int main) { string firstName; string lastName; 6. 9. 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

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT