Question: Write a C++ program, using C++ only . String functions: Read and Output, Concatenate (+) and/or append() string s You will be writing 2 functions

Write a C++ program, using C++ only.

String functions: Read and Output, Concatenate (+) and/or append() strings

You will be writing 2 functions plus a main() function. Here are my function prototypes to get you going. But if you'd rather write your own, that is OK as long as the match the requirements below.

void GetMeals (string& breakf, string& lun, string& din, string& snak); string AllDayMeals (string breakf, string lun, string din, string snak);

  1. Write a function with pass-by-reference parameters, to read in favorite breakfast, lunch, dinner and snack foods (4 strings). These are input a line-at-a-time using getline(cin, ..)
  2. Write a function with pass-by-value parameters, and a return statement that will concatenate these 4 strings into a single string of this format (including the newlines):

My favorite breakfast is bacon and eggs,

my favorite lunch is cheeseburger with fries,

my favorite dinner is meat pinwheels,

and I love to snack on peanuts or almonds!

Write a main() that tests your functions.

  • Call the first to get your meal favs. YOUR CHOICE of meal items (as in, they don't have to match the above).
  • Then call the 2nd function. After that, simply cout << the returned string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!