c++ madlibs

I have a project due at midnight and im stuck. My program isn't compiling properly. Please help.

//CS 161
//Project 1
//Sources: None

#include <iostream>
#include <string>

using namespace std;

int main()
{


string teamName, prezName, bodyPart, dish;
int time;
string Story[3];

cout << "MADLIBS\n";
cout << "Enter the name of a basketball team:";
cin >> teamName;
cout << "Enter the name of a US President: ";
cin >> prezName;
cout << "Enter a body part: ";
cin >> bodyPart;
cout << "Enter the name of a dish: ";
cin >> dish;
cout << "Enter a number: ";
cin >> time;

cout << "BREAKING NEWS!" << endl;

Story[1] = "Star point guard of the " + teamName + ", " + prezName + " has tragically broken their " + bodyPart;
Story[2] = " while cooking a(n) " + dish + ".";
Story[3] = " He is expected to miss " + time + " months due to this injury " + ".";

cout << Story[3] << endl;
}
while string time is technically incorrect, it does the trick for now
Hi,
string Story[3];

this means Story[0]; string Story[1]; string Story[2];

there is no Story[3];

hope it helps

ps:
while string time is technically incorrect, it does the trick for now
for now... :)

pps: welcome to cplusplus.com :)
Last edited on
Topic archived. No new replies allowed.