Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions