In: Computer Science
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.
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;
}