Write a program that reads in the first and last name of a person and formats the full name as the last name, followed by a comma, a space, and the first name. For example: Please enter your first and last name on the next line. Harry Morgan Morgan, Harry

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

C++ programming

Write a program that reads in the first and last name of a person and formats the full name as the last name, followed by
a comma, a space, and the first name. For example:
Please enter your first and last name on the next line.
Harry Morgan
Morgan, Harry
name.cpp
1
#include <iostream>
2
#include <string>
4 using namespace std;
int main()
7
{
8.
cout « "Please enter your first and last name on the next line."
« endl;
10
cout <« full name <« endl;
return 0;
11
12
13 }
Transcribed Image Text:Write a program that reads in the first and last name of a person and formats the full name as the last name, followed by a comma, a space, and the first name. For example: Please enter your first and last name on the next line. Harry Morgan Morgan, Harry name.cpp 1 #include <iostream> 2 #include <string> 4 using namespace std; int main() 7 { 8. cout « "Please enter your first and last name on the next line." « endl; 10 cout <« full name <« endl; return 0; 11 12 13 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

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
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