(Solved) : Pat Smith Kelly Jones Engaged Possible Last Name Combinations Married Couple Listing Pat F Q43977264 . . .
Pat Smith and Kelly Jones are engaged. What are possible lastname combinations for the married couple (listing Pat first)?
- Run the program below to see three possible married-couplenames.
- Extend the program to print the two hyphenated last nameoptions (Smith-Jones, and Jones-Smith). Run the program again
#include <iostream>
#include <string>
using namespace std;
int main() {
string firstName1;
string lastName1;
string firstName2;
string lastName2;
cout << “What is the first person’s firstname?” << endl;
cin >> firstName1;
cout << “What is the first person’s last name?”<< endl;
cin >> lastName1;
cout << “What is the second person’s firstname?” << endl;
cin >> firstName2;
cout << “What is the second person’s last name?”<< endl;
cin >> lastName2;
cout << “Here are some common married-couplenames:” << endl;
cout << firstName1 << ” ” <<lastName1 << ” and ” << firstName2 << ” “<< lastName2 << endl;
cout << firstName1 << ” and ” <<firstName2 << ” ” << lastName1 << endl;
cout << firstName1 << ” and ” <<firstName2 << ” ” << lastName2 << endl;
// FIXME: Print two hyphenated last name options, witheither last name
// appearingfirst. (A hyphen can be written as “-“)
return 0;
}
Expert Answer
Answer to Pat Smith and Kelly Jones are engaged. What are possible last name combinations for the married couple (listing Pat firs…
OR