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

Write a C++ program that does the following:
j. Create a C++ file with the name lab13_2.cpp.
k. Write the function swapFirstLetters which has two strings as parameters permanently swapping the first
character of the two strings.
l. Write the function longestString which has two strings as parameters printing the longer string and
returning the length of the longer string. If both strings are equal length, then use either string.
m. Write the function repeatHello which has an integer as a parameter printing the string Hello the times
equal to repeatHellos parameter.
n. Write the main function that does the following:
i. Prompt the user for their first name and last name.
ii. Call the function swapFirstLetters passing into it those two strings.
iii. Print the two modified names.
iv. Call the function longestString passing into it those two strings.
v. Call the function repeatHello passing into it the length returned by longestString.
Sample run of the program:
Please enter your first name: Dave
Please enter your last name: Miller
Your new first name is Mave
Your new last name is Diller
Diller is the longest string.
HelloHelloHelloHelloHelloHello

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!