Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C + + program that does the following: a . Create a C + + file with the name lab 1 3 _

Write a C++ program that does the following:
a. Create a C++ file with the name lab13_4.cpp.
b. Write the function readInput which has a one-dimensional array and an integer as parameters prompting
the user for strings to fill the one-dimensional array.
c. Write the function getPrefixes which has two one-dimensional arrays and an integer as parameters
copying the first three characters (as a string) of each element of the first array parameter to the
corresponding element of the second array parameter.
d. Write the function concatenateStrings which has a one-dimensional array and an integer as parameters
returning the concatenated string from all the elements of the array parameter.
e. Write the main function that does the following:
i. Declare two string arrays called words and prefixes that each have size 5.
ii. Call the function readInput passing into it the array words and 5.
iii. Call the function getPrefixes passing into it the array words, the array prefixes, and 5.
iv. Call the function concatenateStrings passing into it the array prefixes and 5 assigning its return
value to a string variable.
v. Print the concatenated string.
Sample run of the program:
Enter five words: bird cat dog horse ox
Concatenated string is bircatdoghorox

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

What are the three primary ways a business may use assets?

Answered: 1 week ago