The following code, links together with this post.
#include<iostream> //this is the library that gives the program the ability to have input and output.
using namespace std; //this gives the code more readability.
void intro(); // this is a function
void menuDisplay(); //function
void createdDisplay();
int menuInterface(int &theEnd, int &option); //function
int choiceOneFunction();
int choiceTwoFunction();
int choiceThreeFunction();
int achoiceFunction();
int bchoiceFunction();
int cchoiceFunction();
int AchoiceFunction();
int BchoiceFunction();
int CchoiceFunction();
int onechoiceFunction();
int twochoiceFunction();
int threechoiceFunction();
bool theEND(int &theEnd); //function
int main() // this is the main function, and the most important.
{int theEnd, option; //this declares the types of the variables as integers.
createdDisplay();
intro(); // this calls the intro function.
menuDisplay(); //this function calls the menu up.
menuInterface(theEnd, option); //this function allows for the menu to be interactive.
system(“PAUSE”); //This makes the program stop and wait for the user to enter input.
return 0; // this ends the main function by returning the last value to be zero.
}
void menuDisplay() //this is the function that is called and displays the options in the menu.
{
cout<<”You have just started your first semester of college ever! What is about to takeplace is the craziest semester EVER!! You will have to make the correct choices through the timeline to successfully pass through this first brutal semester. Ona Friday night, you will have to make the choice of either going out to a party with some new friends that seem really \”cool\” or spend the night away at the library studying for the first college exam on the following Monday. This story will begin just like the example. Today is the Friday of your third week of school, and you have your first round of tests coming up next week. What is it that you want to do tonight? \n”<<endl; //this is printed on the screen.
}
void intro() //this is the function that is called and prints the introduction.
{
cout<<”Directions: Select the outcome by typing the desired outcome’s corresponding number and then pressing the ENTER key. “<<endl;
}
void createdDisplay()
{
cout<<”Created by: Arpit Desai and Jonathan Reyes. “<<endl;
}
int menuInterface(int &theEnd, int &option) // this is the function that is called and allows the interface to be interactive.
{theEnd=0; // sets the variable to zero to ensure the loop continues.
enum STORY{PARTONE = 1, PARTTWO, PARTTHREE, PARTFIVE, PARTSIX, THEEND}; //this is an enumeration that makes each variable
cout<<”\n1. Go out with your friends for alcoholic fun!\n”<<endl;
cout<<”2. Go lounge about in the common room at your dorm.\n”<<endl;
cout<<”3. Go to the library and study for hours for the test you have on Monday.\n”<<endl;
cout<<”4. End game prematurely.\n”<<endl; //identified as a number instead of a word so the user can enter a number instead of the word.
cout<<endl; //this makes a linebreak for readability.
cin>>option; //this is the user’s input.
switch(option) //a switch is the menu encoded.
{
case PARTONE: choiceOneFunction(); break; //the user inputs the number, and the corresponding case is activated.
case PARTTWO: choiceTwoFunction(); break;
case PARTTHREE: choiceThreeFunction(); break;
case THEEND: theEnd++; break; //theEnd++ will increase the variables value which will cause the loop to stop via function “bool theEND(int &theEnd).”
default: cout<<”\nERROR. Incorrect choice.\n”<<endl; break; //if the user inputs a wrong value it will let the user know that.
}
}
int choiceOneFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nOkay, you chose to get drunk on that weekend, and completely bombed the test leaving you either failing, or barely passing the class. Now you have the secondround of tests coming up, often called \”Midterms.\” It is Friday night again and your midterms are coming up next week in all of your classes. What to do now? 1. Again go out to party it up with some friends of yours, and just stay up the night before each midterm cramming for it. \n”<<endl;
cout<<”\n2. Get smarter this time and balance out your weekend between fun and library.\n”<<endl;
cout<<”\n3. Or spend every second of the weekend in the library, only coming out to sleep, eat, and maintain proper hygiene.\n”<<endl;
cout<<”\n4. End game prematurely. \n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: achoiceFunction(); break;
case APARTTWO: bchoiceFunction(); break;
case APARTTHREE: cchoiceFunction(); break;
case ATHEEND: theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int choiceTwoFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nBecause of your choice of lounging about on the weekend, you don’t fail the test, but you also dont get an \”A\” or a \”B\” on it. This has made you an average \”C\” student. Now some time has passed, and your midterms are coming up the following week. It is Friday again. What do you want to do? 1. You decide to try your shot at having some alcoholic fun now. \n”<<endl;
cout<<”\n2. Actually go to the library on campus and study for these upcoming midterms. \n”<<endl;
cout<<”\n3. Just go lounge about again, because it worked so well for you last time.\n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: AchoiceFunction(); break;
case APARTTWO: BchoiceFunction(); break;
case APARTTHREE: CchoiceFunction(); break;
case ATHEEND: theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int choiceThreeFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nCONGRATULATIONS!!! You Aced the first test of the semester! Now today is the friday right before your midterms. What are you going to do? 1. Head straight back to the library to do what you did the first time.\n”<<endl;
cout<<”\n2. Goof off a little, by going to a party, since you have an A+ in the class, then go study for the test. \n”<<endl;
cout<<”\n3. Study? What is that? Studying is for chumps.\n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: onechoiceFunction(); break;
case APARTTWO: twochoiceFunction(); break;
case APARTTHREE: threechoiceFunction(); break;
case ATHEEND: theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int achoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nOkay now you are definately failing all your courses for this semester with justa very slim chance of making a grade \”D\” in the class. The only way for this to happen is to get an A on the comprehensive final exam. Again it is Friday night except this time next week are finals. What to do? 1. Go out with your friends again because you have given up in college and you know there is absolutely no way for you to pass the class.\n”<<endl;
cout<<”\n2. Study your behind off this weekend for only half of your classes, so atleast you get some credit for this semester. \n”<<endl;
cout<<”\n3. Somehow study for all your classes that you have a failing grade by pulling allnighters almost every day, getting only 3-5 hours of sleep a night. \n”<<endl;
cout<<”\n4. End game prematurely. \n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”I hope someone will be attending your funeral besides your family because you have just died from the overconsumption of alcohol.”<<endl; break;
case APARTTWO: cout<<”You somehow succeeded in getting A+ on two out of the four finals you had, therfore accomplishing your goal of receiving half the credits.”<<endl; break;
case APARTTHREE: cout<<”WOW!! You are one amazing person. I have no idea what happened. If it was luck, so be it, you have passed all your classes with a minimum grade. Of course that also means your GPA for the semester is a 1.0, but you also have atleast 7 more semesters to get it pretty high up. It will be a pretty tough road for you. Good Luck!”<<endl; break;
case ATHEEND: theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int bchoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nWow, you went from a failing grade to a having a low B in the class. Now finals are coming up next week. And now its the friday night before the finals. What are you going to do now? 1. Study hard this weekend to bring up the low B to maybe an A or a B+.\n”<<endl;
cout<<”\n2. Go and get drunk again! Have a good time with no worries about the tests.\n”<<endl;
cout<<”\n3. Get lazy and do nothing except sit in bed and watch a random t.v. show on your laptop. \n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou study and take the test. You did not get the grade you wanted, but your final grade in the class is a low B. Congrats!\n”<<endl; break;
case APARTTWO: cout<<”\nThe party you were at got busted for drugs, and now everybody is in jail withoutrelease unlease released into the custody of a guardian. You missed the final, and failed the course.\n”<<endl; break;
case APARTTHREE: cout<<”\nThe t.v. show was actually about your final and out of sheer luck you pass with flying colors, raising your average to an A!!!\n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int cchoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nYou had a \”D\” in the class, but now you have a B+!! Woot! It is now the Friday before finals. What are you going to do? 1. Get overconfident and go party!! You have a B+ and do not care at all!\n”<<endl;
cout<<”\n2. Head back to the library to do what you did before. Your philosophy, it worked once, it will work again. \n”<<endl;
cout<<”\n3. Lounge about not caring, and just hang out with all your friends.\n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou don’t get caught but you do get a concussion falling down the stairs and geta minor case of amnesia. You had to take the final not knowing anything. You arevery lucky as the final grade in the class is a C+.\n”<<endl; break;
case APARTTWO: cout<<”\nYour philosophy was wrong, and you overwork yourself. You failed the course. Tough luck. Maybe next time try to have some fun!\n”<<endl;break;
case APARTTHREE: cout<<”\nYou failed horribly. You don’t know what to do now. So you commit suicide. You are the weakest link, Goodbye.\n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int AchoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nOkay. You did not make the correct choice last time, and this time you have failed in making the correct choice. Because of the heavy drinking that occured over the weekend, you had forgotten everything that would be on the test, utterly failing the exam. Now you have a failing average in the class with the finals coming up next week. It is possible for you to get a \”B\” in the class by getting an \”A\” on the final. What do you do now? 1. You think that the test will be super easy and go out drinking again.\n”<<endl;
cout<<”\n2. Seeing as how lounging about let you make a decent break, you do the same this time.\n”<<endl;
cout<<”\n3. You go to the library, sit down, and actually study for the class. \n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nBad choice. You have just failed the course(s) and now have to retake every failing class next semester. I hope you don’t make the same mistake twice.\n”<<endl; break;
case APARTTWO: cout<<”\n2. You have some luck on your side, lounging about got you the \”C\” on the final giving you a solid passing grade for the class. \n”<<endl; break;
case APARTTHREE: cout<<”\n3. Correct choice! Your studying paid off in the long run and you aced the final!! You recieved a \”B\” in the course. Good Luck to you in life!\n”<<endl; break;
case ATHEEND:cout<<”\n4. Ended game. \n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int BchoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nAwesome choice! You got an \”A\” on the midterm and now have a \”B+\” in the class. You are now doing great in the class, and again the fateful Friday night is here. Your finals are next week… What to do?? 1. GO PARTY!! WOOT! You have a B+ average and an F on the final will only bring you down to a grade of \”D\” \n”<<endl;
cout<<”\n2. By now, you have become a professional lounger. And lounging is what you do best. Obvious choice here is to lounge about before the final and just wing it, hoping you get lucky.\n”<<endl;
cout<<”\n3. You can now do what you did last time, and that is go to the library to studynight and day for this exam to hope to bring in your first \”A\” of the semester!\n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou had it going so good for you and then you make a bad choice. The party you were at got busted and the University expelled you for having a BAC of 0.32. Youhave failed in life. Good Luck with whats left!\n”<<endl; break;
case APARTTWO: cout<<”\nYour lounging about has made you to barely fail the course. Your score on the final was just one question short of having a minimum passing grade. Tough luck.\n”<<endl; break;
case APARTTHREE: cout<<”\nYou have secured your first \”A\” of the semester! Congratulations!\n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int CchoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nAfter lounging again, the results of the midterms come back in. You failed. Now in the course, you are barely failing the course. Today is the Friday before finals week, what are you going to do tonight/this weekend? 1. Lounge again, this time thinking that the third time is the charm.\n”<<endl;
cout<<”\n2. You don’t take any chances and go straight to the library.\n”<<endl;
cout<<”\n3. You don’t take it seriously, thinking it will be like highschool and you willpass it easily.\n”<<endl;
cout<<”\n4. End game prematurely. \n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou Failed. Sorry. \n”<<endl; break;
case APARTTWO: cout<<”\nYou Failed. Sorry. Even though you did spend one weekend studying, the test covered too much information. \n”<<endl; break;
case APARTTHREE: cout<<”\nYou Failed. Sorry. \n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int onechoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nOH NO! You spent too much time in the library and built up too much stress studying. You new average in the class is barely a B-. Now its the Friday night before the week of finals. What are you going to do? 1. Go out tonight to watch a movie with some friends, and come back right after to sleep. Then for the rest of the weekend it is study time!\n”<<endl;
cout<<”\n2. You don’t think you have too much built up stress and go straight back to library to start studying.\n”<<endl;
cout<<”\n3. You think you have too much built up stress, and just lounge about and relax the whole weekend. \n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou took the test a little stressed out, but managed to raise your grade. Your new grade is a \”B+.\” Good Job! But remember to try and be stress-free!\n”<<endl; break;
case APARTTWO: cout<<”\nYou epically fail the final, bringing your class average down below the passing line. You stressed out, now retake the class.\n”<<endl; break;
case APARTTHREE: cout<<”\nBecause the final was comprehensive, you did not have much to study for it in reality. You Aced the final bringing up your class average to an A! Congratulations! \n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int twochoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nThe party helped you greatly. You went to take your midterm stress-free and now Aced this exam! Congratulations! But now the friday night before finals weeks isalready here. What will you do now? 1. Not care for the final because you think even if you get a 0 on this final, you would still pass the class.\n”<<endl;
cout<<”\n2. You study for the final while you are in your own comfort zone instead of thelibrary.\n”<<endl;
cout<<”\n3. You go straight back to the library and do what you have been doing to see ifyou can Ace this upcoming exam also.\n”<<endl;
cout<<”\n4. End game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou sleep through the final with no second thoughts about doing so. Your transcript comes home, and you see that you failed the course. Dont you feel pretty dumb now?\n”<<endl; break;
case APARTTWO: cout<<”\nUnforutunately, you do not ace the final, but you do get an \”A\” on the final, therefore your average is still an A+.\n”<<endl; break;
case APARTTHREE: cout<<”\nCongratulations!! You don’t let all the stress get to you, and Ace this test! This is the first time this has happened to the professor, and now both of you are overjoyed. Congratulations again, and make sure to ask that professor to write a generic letter of recommendation. \n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
int threechoiceFunction()
{
int theEnd=0;
int option;
enum ASTORY{APARTONE = 1, APARTTWO, APARTTHREE, ATHEEND};
cout<<”\nYour attitude about studying leads to you not studying at all and then for this midterm, you failed it horribly. To barely pass the class, you will need to Ace this upcoming final. Today is Friday, the last school day before finals week. What is that you want to do? 1. You go straight to the library to start studying. You let nothing stop you from getting to the library.\n”<<endl;
cout<<”\n2. Since you have experience in Acing a test, you do not worry about this upcoming one, therefore you lounge about.\n”<<endl;
cout<<”\n3. Out of no-where, you develop the theory the professor has it out for you, andfocus more on proving that theory correct, rather than studying.\n”<<endl;
cout<<”\nEnd game prematurely.\n”<<endl;
cout<<endl;
cin>>option;
switch(option)
{
case APARTONE: cout<<”\nYou sit down to take the final, and zip right through it. At first you are scared it was too easy, then grades come in. You missed one question, but the professor believed you learned and gave it to you. Congrats! You passed!\n”<<endl; break;
case APARTTWO: cout<<”\nYou lounge about and during testing time, you miss only 19 problems…out of 20.You Fail.\n”<<endl; break;
case APARTTHREE: cout<<”\nYou failed the final, therefore the course as well. You messed up big time as school progressed through the semester.\n”<<endl; break;
case ATHEEND:cout<<”\nGame Ended.\n”<<endl; theEnd++; break;
default: cout<<”\nERROR. Incorrect choice.\n”<<endl;break;
}
}
bool theEND(int &theEnd) //this is the function that evaluates whether or not the story is over.
{
if(theEnd==0)
{
return true; //returns true to the while() part of the loop because
//the user has not selected “The End.”
}
else
{
return false;
}
}
Entries (RSS)
December 6th, 2009 at 10:07 pm
[...] the scared-y cat. The code that links with the final project » Dec 06 [...]