Hi i am trying to create a program in which i allow the user toenter a couple of
ID: 3614238 • Letter: H
Question
Hi i am trying to create a program in which i allow the user toenter a couple of words and then the program will put specificwords into the final string in a logical order. for example i wouldask for noun successively then in the final string the programinputs it into the string. Here is my starting program:#include <iostream>
#include <strings>
using namespace std;
int main()
{
int ADJ
int PLNOUN
int NOUN
int PROPERNOUN
cout << "This is a program to produce a crazy story.Please/n"
cout << "input a word when asked... the sillier thebetter./n"
"/n"
cout << "Input an Adjective: /n"//stinky
cin >>ADJ;
cout << "Input an Adjective: /n"//slimy
cin >>ADJ;
cout << "Input a Plural Noun: /n"//eyeballs
cin >>NOUN;
cout << "Input a Noun: /n"//banana
cin >>NOUN;
cout << "Input an Adjective: /n"//lying
cin >>ADJ;
cout << "Input a Noun: /n"//chicken
cin >>NOUN;
cout << "Input a Noun: /n"//blender
cin >>NOUN;
cout << "Input a Plural Noun: /n"//hats
cin >>NOUN;
cout << "Input an Adjective: /n"//disgusting
cin >>ADJ;
cout << "Input a Proper Noun: /n"//Pinhead
cin >>PROPERNOUN;
cout << "Input an Adjective: /n"//deranged
cin >>ADJ;
cout << "Input a Noun: /n"//cheese
cin >>ADJ;
cout << "Input a Noun: /n"//dog
cin >>ADJ;
cout << ":Input a Noun: /n"//radio
cin >> ADJ;
cout << "Input an Adjective: /n"//enraged
cin >>ADJ;
cout << "Input an Adjective: /n"//boring
cin >>ADJ;
cout << "Input an Adjective: /n"//malodurus
cin >>ADJ;
cout <<"Ladies and gentlemen, on this"<< ADJ << "occasion, it is a/n"
cout <<"privilege to address such an "<< ADJ <<"-looking group of "<<PLNOUN<<"./n"
cout <<"I can tell from your smiling"<<NOUN<<" that you will support my/n"
cout << ADJ<< "program in the coming election. Ipromise that, if elected,/n"
cout <<"there will be a "<< NOUN<< " in every"<<NOUN<<" and two "<<PLNOUN<<" inevery/n"
cout <<"garage. I want to warn you against my"<<ADJ<<" opponent,"<<PROPERNOUN<<"./n"
cout <<"This man is nothing but a "<<ADJ << NOUN<<". He has a cantankerous/n"
cout <<"character and is working "<<NOUN<<" inglove with the criminal element./n"
cout <<"If elected, I promise to eliminate vice. I will keepthe "<<NOUN<<" in/n"
cout <<"the public till. I promise you "<<ADJ<<"government, "<<ADJ<<" taxes,/n"
cout <<"and "<<ADJ<<" schools./n"
return 0;
}
Explanation / Answer
#include #include using namespace std; int main() { string ADJ =""; string PLNOUN =""; string NOUN = ""; string PROPERNOUN =""; string s=""; cout NOUN; s += "I can tell from your smiling "+ NOUN +" that you will support my "; cout >ADJ; s+= ADJ + " program in the coming election. Ipromise that, if elected, "; cout >NOUN; s += "there will be a " + NOUN; cout >NOUN; cout >PLNOUN; s += " in every " + NOUN +" and two" + PLNOUN +" in every "; cout >ADJ; cout >PROPERNOUN; s += "garage. I want to warn you against my"+ADJ +" opponent, " +PROPERNOUN + ". "; cout >ADJ; cout >NOUN; s += "This man is nothing but a " + ADJ +" "+NOUN +". He has a cantankerous "; cout >NOUN; s += "character and is working " +NOUN + " inglove with the criminal element. "; cout > NOUN; s += "If elected, I promise to eliminate vice. Iwill keep the " + NOUN +" in "; cout >ADJ; s += "the public till. I promise you " +ADJ +"government, "; cout >ADJ; s += ADJ +" taxes, "; cout >ADJ; s += "and " + ADJ +" schools. "; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.