Question

In: Computer Science

Create the logic for a rhyming program that takes in five words from a user input...

  1. Create the logic for a rhyming program that takes in five words from a user input and replaces the selected rhyming words with the user's input, then creates and displays the Humpty Dumpty rhyme with the five words from the user input.

Hint:

1. You will use the sentinel values: start and stop

2. The program will ask the user for 5 words.

3. The program will store the 5 words

4. The program outputs the rhyme replacing the ____ with the words provided by the user. (Remember, the program doesn't know what words will be entered, but it will store it in order to display them in the rhyme.

5. The output statement will display the rhyme with the user's inputs.

Humpty Dumpty sat on a  ------,

Humpty Dumpty had a great -----l;

All the king's ----- and all the king's -----

Couldn't put Humpty Dumpty  ----- again.

Solutions

Expert Solution

C++ Program for this problem is -

#include <iostream>
using namespace std;
int main()
{
cout<<"Start\n";
string word1,word2,word3,word4,word5;
cout<<"Enter first Word : ";
cin >>word1 ;
cout<<"Enter second Word : ";
cin >>word2 ;
cout<<"Enter third Word : ";
cin >>word3 ;
cout<<"Enter fourth Word : ";
cin >>word4 ;
cout<<"Enter fifth Word : ";
cin >>word5 ;
cout<<"\nHumpty Dumpty sat on a "<<word1<<"\nHumpty Dumpty had a great "<<word2<<"\nAll the king's "<<word3
<<"\nand all the king's "<<word4<<"\nCouldn't put Humpty Dumpty "<<word5 <<" again\n";
cout<<"\nStop";
return 0;
}


Related Solutions

IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
(JAVA) Create a program that prompts the user for an age input. The program defines the...
(JAVA) Create a program that prompts the user for an age input. The program defines the age group of the user. Follow the table below to construct the output for your program. Age Age Group 0 Baby 1-3 Toddler 4-11 Child 12-17 Teenager 18-21 Young Adult 22-64 Adult 65+ Senior Negative Number Invalid Input Sample Input Enter an age: 18 Sample Output: You are a young adult. Sample Input Enter an age: 29 Sample Output: You are an adult. Sample...
Write a complete C++ program that prompts the user for and takes as input, numbers until...
Write a complete C++ program that prompts the user for and takes as input, numbers until the user types in a negative number. the program should add all of the numbers together. Then if the result is less than 20 the program should multiply the result by 3, otherwise subtract 2 from the result. Finally, the program should printout the result.
create a program using IDLE where you will gather input from the user using a loop....
create a program using IDLE where you will gather input from the user using a loop. The user needs to provide you with a list of test scores for two categories (two different classrooms). Test scores must be integer values between 0 and 10. You need to process each score so that you can output the following: Number of test scores entered for classroom A. Number of test scores entered for classroom B. Average of test scores entered for classroom...
create a program using IDLE where you will gather input from the user using a loop....
create a program using IDLE where you will gather input from the user using a loop. The user needs to provide you with a list of test scores for two categories (two different classrooms). Test scores must be integer values between 0 and 10. You need to process each score so that you can output the following: Number of test scores entered for classroom A. Number of test scores entered for classroom B. Average of test scores entered for classroom...
Create a C++ program that will prompt the user to input an integer number and output...
Create a C++ program that will prompt the user to input an integer number and output the corresponding number to its numerical words. (From 0-1000000 only) **Please only use #include <iostream>, switch and if-else statements only and do not use string storing for the conversion in words. Thank you.** **Our class is still discussing on the basics of programming. Please focus only on the basics. Thank you.** Example outputs: Enter a number: 68954 Sixty Eight Thousand Nine Hundred Fifty Four...
Using C++ Create a program that asks the user to input a string value and then...
Using C++ Create a program that asks the user to input a string value and then outputs the string in the Pig Latin form. - If the string begins with a vowel, add the string "-way" at the end of the string. For “eye”, it will be “eye-way”. - If the string does not begin with a vowel, first add "-" at the end of the string. Then rotate the string one character at a time; that is, move the...
OBJECTIVE C 2) // Create a small app that takes user input and performs a useful...
OBJECTIVE C 2) // Create a small app that takes user input and performs a useful calculation with that user input // - make sure that absolutely no input crashes the app. // - Use layout constraints to make sure the app looks good in portraint and landscape mode, as well as on small and large devices.
Using RAPTOR create a program that allows the user to input a list of first names...
Using RAPTOR create a program that allows the user to input a list of first names in on array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. the output should be a list of email address where the address is of the following form: [email protected]
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT