using c Write a program with the following GetFirst Write a

using c++

Write a program with the following:

GetFirst: Write a function that does not take any parameters that asks the user for his/her first name.

GetFull: Write a function that takes one parameter that is the first name (this should be passed from the main program after being returned from the first function). This function should ask the user for his/her last name and return the full name to the main program.

Main: Your main program should call both functions and write the full name to a file.

Solution

#include #include #include using namespace std; string GetFirst(); string GetFull(string lastEntered); int main() { string firstName; string lastName; string lastResult; string fullName; ofstream outData; firstName = GetFirst(); cout << \"Enter your last name: \"; cin >> lastName; lastResult = GetFull(lastName); fullName = firstName + \" \" + lastResult; outData.open(\"Results.txt\"); outData << fullName << endl; } string GetFull(string lastEntered) { string firstName; firstName = GetFirst(); string result; result = lastEntered; return result; } string GetFirst() { string fName; cout << \"Enter your first name: \"; cin >> fName; return fName; }
using c++ Write a program with the following: GetFirst: Write a function that does not take any parameters that asks the user for his/her first name. GetFull: W

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site