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

Write a program that takes a string input from the user and then outputs the first...
Write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word. After going up to the full word, go back down to a single letter. LastNameUpDown. Input: Kean Output: K Ke Kea Kean Kea Ke K
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....
I need someone to create a program for me: Create a program that takes as input...
I need someone to create a program for me: Create a program that takes as input an employee's salary and a rating of the employee's performance and computes the raise for the employee. The performance rating here is being entered as a String — the three possible ratings are "Outstanding", "Acceptable", and " Needs Improvement ". An employee who is rated outstanding will receive a 10.2 % raise, one rated acceptable will receive a 7 % raise, and one rated...
(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...
You are to create a program to request user input and store the data in an...
You are to create a program to request user input and store the data in an array of structures, and then display the data as requested. The data you are collecting refers to a set of images. The images are OCT images taken of the lining of the bladder. The data you provide will help diagnose the image as cancerous or not, but your code does not need to do that at the moment. First, Define a global structure that...
Directions: Create a program that takes as input an employee's salary and a rating of the...
Directions: Create a program that takes as input an employee's salary and a rating of the employee's performance and then computes the appropriate raise for the employee based on that rating. The performance rating is entered into the program as a String. The three possible ratings are "Outstanding", "Acceptable", and "Needs Improvement". An employee who is rated as Outstanding will receive a 10.2% raise, one rated Acceptable will receive a 7% raise, and one rated as Needs Improvement will receive...
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...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT