Using the code stub below, write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.
Example output if the input is: Akua Mperey
Mperey, Akua
#include <iostream>
#include <string>
using namespace std;
int main() {
string firstName;
string lastName;
/* Your solution goes here */
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main() {
string firstName;
string lastName;
cout<<"\nEnter first Name: ";
cin>>firstName;
cout<<"\nEnter last Name: ";
cin>>lastName;
cout<<lastName<<","<<firstName;
return 0;
}
Comments
Leave a comment