Write a program that plays the game of MAd libs , Your program should prompt the
ID: 3550421 • Letter: W
Question
Write a program that plays the game of MAd libs , Your program should prompt the user to enter the following strings:
the first or last name of instructor
your name
a food
a number betweeen 100 and 120
an adjective
a color
and a animal
#include <iostream>
using namespace std;
int main()
{
string instructorName,name,food,number,adjective,color,animal;
string word; prompt;
char space;
ifstream in;
int num;
cout<<"Enter the first or last name of your instructor: ";
cin >> instructorName;
cout << "Enter your name: ";
cin >> yourName;
cout << "Enter a food item: ";
cin >> food;
cout<<"Enter a number between 100 and 120: ";
cin >> number;
cout <<" Please enter an adjective: ";
cin >>adjective;
cout <<" Enter a color: ";
cin >> color
cout <<"Please enter an animal: ";
cin >> animal;
cout << "Dear instructor " cout << intructorName;
cout << ",: ";
cout << "I am so sorry that I am unable to turn in my homework at this time. ";
cout << " First, I ate a rotten ";
cout << food;
cout << ", which made me turn ";
cout << color;
cout << " and extremely ill. I came down with a fever of ";
cout << number;
cout << ". Next my ";
cout << adjective;
cout << " pet ";
cout << animal;
cout << " must have smelled the remains of the :";
cout << food;
cout << " on my homework, because he ate it. ";
cout << " I am currently rewritting my homework and hope you will accept it late. ";
cout << "Sincerely, ";
cout << yourName;
return 0;
}
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
string instructorName,name,food,number,adjective,color,animal,yourName;
string word; //prompt;
char space;
//ifstream in;
int num;
cout<<"Enter the first or last name of your instructor: ";
cin >> instructorName;
cout << "Enter your name: ";
cin >> yourName;
cout << "Enter a food item: ";
cin >> food;
cout<<"Enter a number between 100 and 120: ";
cin >> number;
cout <<" Please enter an adjective: ";
cin >>adjective;
cout <<" Enter a color: ";
cin >> color;
cout <<"Please enter an animal: ";
cin >> animal;
cout << "Dear instructor "; cout << instructorName;
cout << ",: ";
cout << "I am so sorry that I am unable to turn in my homework at this time. ";
cout << " First, I ate a rotten ";
cout << food;
cout << ", which made me turn ";
cout << color;
cout << " and extremely ill. I came down with a fever of ";
cout << number;
cout << ". Next my ";
cout << adjective;
cout << " pet ";
cout << animal;
cout << " must have smelled the remains of the :";
cout << food;
cout << " on my homework, because he ate it. ";
cout << " I am currently rewritting my homework and hope you will accept it late. ";
cout << "Sincerely, ";
cout << yourName;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.