Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the program Visual Studio 2019 Question #3: New Word (6 pts) Write a program that prompts the user for two words (W1 and W2)
Using the program Visual Studio 2019
Question #3: New Word (6 pts) Write a program that prompts the user for two words (W1 and W2) with 3 characters. Your program should behave as follow: 1. Display a welcome message. 2. Ask the user for the inputs of two words. 3. Display the lengths of both words. 4. Use a new string to merge two words. The new word should follow: a. The sequence: 3rd character of W1 + 3rd character of W2 + 1st character of W1 + 1st character of W2 + 2nd character of W1 + 2nd character of W2, display the new generated word. b. Swap the 2nd and 6th characters of the new word. C. Swap the 1st and 5th characters of the new word. 5. Display the new word. 6. Display a farewell message, so that the user knows that the program has terminated normally. Restrictions: No looping statements allowed (or needed). This question requires the use of the functions: length(), substr(). Following are the sample screen shots to illustrate the expected behavior of your program. User input at the keyboard is marked with a red circle. Your program should work with any word with 3 characters entered by the user. Assume a perfect user who will always enter a word with exactly 3 characters. Note: Your program must display the same information and formatted the same. Welcome to New Word Program Enter the first word with 3 characters: abc Enter the second word with 3 characters: cde The length of the word abc is 3. The length of the word cde is 3. The new word is: ceacbd. Generating the new word... The new word is: bdacce. Thank you for using New Word Program! Figure 4 - Sample output #1 for Question 3 Welcome to New Word Program Enter the first word with 3 characters: 12k Enter the second word with 3 characters: kj9 The length of the word 12k is 3. The length of the word kj9 is 3. The new word is: k91k2j. Generating the new word... The new word is: 2j1kk9. Thank you for using New Word Program! Figure 5 - Sample output #2 for Question 3 Welcome to New Word Program Enter the first word with 3 characters:Enter the second word with 3 characters: ?!f The length of the word
is 3. The length of the word ?!f is 3. The new word is: >ff. Thank you for using New Word Program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started