C++ Choose Your Own Adventure

Hey, I haven't been on these boards in a LONG time so forgive me if this is out of context here.

I'm responsible for coding a "Choose Your Own Adventure" for my C++ final. I'm only passing this class because I've put in extra time, and I'm actually in a position to pull a B if I do well on this (I am not good at coding).

For the time being, this is my code.

char day[10];
char name[12];
char shower;
char shirt;

cout<< "Welcome to the Interactive Choose Your Own Adventure!" <<endl;
cout<< "Remember, nice guys don't always finish last!" <<endl;
cout<< "Just most of the time......."<<endl;
cout<< "For all questions, enter Y for Yes, and N for No! It's easy!!\n";
cout<<endl<< "Here we go!!"<<endl<<endl;
system("PAUSE");
cout<<"Before we get started, what's your first name? ";
cin >> name;
cout<<endl<<"What's today? I think it's either Sunday or Monday...";
cin >> day;
cout<<"Good. I think we can get started. You sure you're ready? ";
cout<<endl;
system("PAUSE");
cout<<endl;
cout<<"It's "<< day << " morning. Do you want to take a shower before you ";
cout<<"embrace the day?: ";
cin >> shower;

if (shower == 'Y' || shower == 'y')
{
cout<< "\nYour name must not be Bradley. Thank goodness you're clean!\n\n";
}

else if (shower == 'N' || shower == 'n')
{
cout<< "Wow that's awful. Do you know this guy named Bradley?\n";
cout<< "He never showered at all. Now he doesn't have any friends\n\n";
}

cout<<"Now that you're out of bed, it's time to get dressed. What do you ";
cout<<"want to wear with your jeans, a (P)olo, (T)ee, or (B)eater?:\n ";
cout<<"***If you aren't smart enough to figure it out, enter the letter that";
cout<<" is enclosed in the () for your choice***\n";
cout<<"Wait, what was it you wanted to wear again?: "<<endl;
cin >>shirt;


I've got the gist of it. What I'd like to know is if it's plausible to continue writing this program in this fashion, including future choices inside the original if statements, or switching to a program run by functions, such as:


void InvokeChoice1();
void InvokeChoice2();

int main(int,char *[])
{
// lots of stuff before this

int nValue = 0;

cout << "What would you like to do? 1) Fight the monster 2) Run away..." << std::endl;

cin >> nValue;

if (nValue == 1)
{
InvokeChoice1();
}
else if (nValue == 2)
{
InvokeChoice2();
}


Any opinions are welcome. If possible, a quick demonstration of how I could get this code working into a legimate program (6 endings, 13 unique choices), would be absolutely fantastic! Thanks in advance.
Last edited on
I really doesnt matter, either way is fine. But what is the point of this program, what is it getting to?
It's actually for the final of my C++ class. Basically all that's required is an original program that my instructor approves (he approved this idea). Do you think you could tell which one will end up being the most time efficient?
Functions are the way to go if you want to learn how to program.
Yes



Last edited on
Well functions would be better to use, but i think you would end up with just a bunch of void functions that really would make a huge difference in you program.
Hello,

"But what is the point of this program, what is it getting to?"

It displays classic dayly events by a minute. The alarm-clock is missing up there.
Topic archived. No new replies allowed.