#4
Some of the code is given already
We just need to expand it
Work on the voidProgram part
APTER 8/ Strings and Vectors Repeat Practice Program 1 except use the class string to extract not the cstring functions 2. 3. Write a program that inputs a first and last name, separated by a sp into a string variable. Use the string functions to output last initial. Embed your code into a do-while loop At the end of the loo ask the user if he or she would like to repeat the program. Input the choice into a char using cin. If the character is 'y then repeat the program otherwise exit. Beware of the pitfall with newlines when cin is mixed with getline. user's 4. Write a function named firstLast2 that takes as input a vector of integers. The function should return true if the vector starts or ends with the digit 2. Otherwise it should return false. Test your function with vectors of dif- ferent length and with the digit 2 at the beginning of the vector, end of the vector, middle of the vector, and missing from the vector. 5. Write a function named swapFront Back that takes as input a vector of inte- gers. The function should swap the first element in the vector with the last element in the vector. The function should check if the vector is empty to prevent errors. Test your function with vectors of different length and with varying front and back numbers. Do Practice Program 7.4 except change the program to use vectors of strings instead of arrays of strings. 6. 7. Write a program that inputs two string variables, first and 1ast, each of which the user should enter with his or her name. First, convert both strings to all lowercase. Your program should then create a new string that contains the full name in Pig Latin with the first letter capitalized for the first and last name. The rules to convert a word into Pig Latin are as follows: If the first letter is a consonant, move it to the end and add "ay"' to the end. If the first letter is a vowel, add "way" to the end For example, if the user inputs "Erin" for the first name and "Jones" the last name, then the program should create a new string v Erinway Onesjay" and print it. with the t ROGRAMMING PROJECTS rogramming Projects require more problem-solving than Practice Pro grams and Visit www.myprogramminglab.com sually be s . an olved many different ways