My project worked right up until i wrote about the "after three months" After that part the rest of the code wont work it's like there is a getch () there. it says there are no errors but that "1 up to date" any ideas? I did ask my teacher for permission before posting this but he is stumped to. I will be siting the website and the users that help me thanks.
#include <iostream>
#include <conio.h>
#include <stdlib.h>
usingnamespace std;
int main()
{
char name[50];
cout << "What is your name?" << endl;
cin.getline(name, 50);
cout << "!!!----------------------Chapter One: Where am I?----------------------!!!" << endl;
cout << "Stranger: Wake up! Hurry! Get up!" << endl;
cout << "(You wake up startled)" << endl;
cout << "You: What happened?" << endl;
cout << "Stranger: No time, My guys will be arriving soon we have to hurry." << endl << endl;
system ("pause");
int choiceOne_Path;
cout << "# What would you like to do?" << endl;
cout << ">> Enter '1' I'm not going with you your crazy *Run away* " << endl;
cout << ">> Enter '2' OK what ever you say but I demand an explanation when we get where ever we are going " << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
if(choiceOne_Path == 1)
{
cout << "You run away before he can even say a word. You run right into a group of angry looking people brandishing weapons. Looks like you should have listened" << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
}
elseif (choiceOne_Path == 2)
{
cout << "Stranger: You will have all the answears you need when we get out of here now lets get to my guys.";
cout << "\n----------------------Press any key to continue----------------------" << endl;
system ("pause");
system("CLS");
cout << "Stranger: Ok my guys are right up ahead" << endl;
cout << "You: Let's just hurry this up I want to know whats going on" << endl << endl;
system ("pause");
system ("CLS");
}
if (choiceOne_Path == 2)
{
cout << "just as you are preparing to reach his guys you notice a snake in the road." << endl << endl;
cout << "Enter '1' to attempt to kill the snake" << endl;
cout << "Enter '2' to let the guy with the weapons kill it" << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
system ("CLS");
}
if (choiceOne_Path == 1)
{
cout << "The snake bites you with its large fangs. The venom drops you after two feet"<< endl << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
getch ();
}
if (choiceOne_Path == 2)
{
cout << "The stranger brandishing a great sword chops down the snake in one mighty swing."<< endl << endl;
system ("pause");
cout << "Stranger: Very wise letting me take the snake, but now that i think about it you are a little under equip";
cout << "*Stranger hands you a simple knife*"<< endl;
cout << "Stranger: Only use it if you have to its old and flimbsy";
cout << "You: Alright.";
system ("pause");
system ("CLS");
cout << "After walking for what seems like ages you finally get out of the tunnel you were in. Infront of you in a large group of shady looking men" << endl;
cout << "Enter '1' to do nothing" << endl;
cout << "Enter '2' to charge the group of men with your new knife" << endl;
cout << "Enter '3' to sneak away and wonder the woods." << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
}
if (choiceOne_Path == 1)
{
cout << "You wait for something to happen.After about 3 seconds the stranger lets out a laugh."<< endl;
cout<< " he walks over to them and talks for alittle before he tells you to come on.";
cout << "*You have escaped.";
system ("pause");
return 0;
getch ();
}
if (choiceOne_Path == 2)
{
cout << "You charge the group dagger in hand feeling brave. One pulls out a sword in impales you before you can do damage.You are dead."<< endl << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
getch ();
}
if (choiceOne_Path == 3)
{
cout << "You sneak away quietly before anyone sees you"<< endl;
cout<< "you start wondering the woods and before you have time to react a are being mualed by a grizzly." << endl;
cout << "*Dead* Game over";
system ("pause");
return 0;
getch ();
}
if (choiceOne_Path == 1)
{
cout << "You wait for something to happen.After about 3 seconds the stranger lets out a laugh."<< endl;
cout<< " he walks over to them and talks for alittle before he tells you to come on." << endl << endl;
cout << "*You have escaped." << endl;
system ("pause");
system ("cls");
cout << "Three months later....." << endl << endl;
cout << " After getting to learn everyones name, you learn the stranger that helped you was named Rees" <<endl;
cout << " He has been getting people like you that were thrown in jail and training them for his cause." << endl;
cout << " The only thing he demands is the loyalty of his followers. If they didn't agree they went back to the slammer." << endl;
cout << " You swore your life to helping his cause of slaying monsters that would do good folks harm";
system ("pause");
system ("cls");
getch ();
}
}
#include <iostream>
#include <stdlib.h>
usingnamespace std;
int main()
{
char name[50];
cout << "What is your name?" << endl;
cin.getline(name, 50);
cout << "!!!----------------------Chapter One: Where am I?----------------------!!!" << endl;
cout << "Stranger: Wake up! Hurry! Get up!" << endl;
cout << "(You wake up startled)" << endl;
cout << "You: What happened?" << endl;
cout << "Stranger: No time, My guys will be arriving soon we have to hurry." << endl << endl;
system ("pause");
int choiceOne_Path;
cout << "# What would you like to do?" << endl;
cout << ">> Enter '1' I'm not going with you your crazy *Run away* " << endl;
cout << ">> Enter '2' OK what ever you say but I demand an explanation when we get where ever we are going " << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
if(choiceOne_Path == 1)
{
cout << "You run away before he can even say a word. You run right into a group of angry looking people brandishing weapons. Looks like you should have listened" << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
}
elseif (choiceOne_Path == 2)
{
cout << "Stranger: You will have all the answears you need when we get out of here now lets get to my guys.";
cout << "\n----------------------Press any key to continue----------------------" << endl;
system ("pause");
system("CLS");
cout << "Stranger: Ok my guys are right up ahead" << endl;
cout << "You: Let's just hurry this up I want to know whats going on" << endl << endl;
system ("pause");
system ("CLS");
}
if (choiceOne_Path == 2)
{
cout << "just as you are preparing to reach his guys you notice a snake in the road." << endl << endl;
cout << "Enter '1' to attempt to kill the snake" << endl;
cout << "Enter '2' to let the guy with the weapons kill it" << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
system ("CLS");
}
if (choiceOne_Path == 1)
{
cout << "The snake bites you with its large fangs. The venom drops you after two feet"<< endl << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
}
if (choiceOne_Path == 2)
{
cout << "The stranger brandishing a great sword chops down the snake in one mighty swing."<< endl << endl;
system ("pause");
cout << "Stranger: Very wise letting me take the snake, but now that i think about it you are a little under equip";
cout << "*Stranger hands you a simple knife*"<< endl;
cout << "Stranger: Only use it if you have to its old and flimbsy";
cout << "You: Alright.";
system ("pause");
system ("CLS");
cout << "After walking for what seems like ages you finally get out of the tunnel you were in. Infront of you in a large group of shady looking men" << endl;
cout << "Enter '1' to do nothing" << endl;
cout << "Enter '2' to charge the group of men with your new knife" << endl;
cout << "Enter '3' to sneak away and wonder the woods." << endl;
cout << "\nEnter your choice: ";
cin >> choiceOne_Path;
}
if (choiceOne_Path == 1)
{
cout << "You wait for something to happen.After about 3 seconds the stranger lets out a laugh."<< endl;
cout<< " he walks over to them and talks for alittle before he tells you to come on.";
cout << "*You have escaped.";
system ("pause");
return 0;
}
if (choiceOne_Path == 2)
{
cout << "You charge the group dagger in hand feeling brave. One pulls out a sword in impales you before you can do damage.You are dead."<< endl << endl;
cout << "*Dead* game over" << endl;
system ("pause");
return 0;
}
if (choiceOne_Path == 3)
{
cout << "You sneak away quietly before anyone sees you"<< endl;
cout<< "you start wondering the woods and before you have time to react a are being mualed by a grizzly." << endl;
cout << "*Dead* Game over";
system ("pause");
return 0;
}
if (choiceOne_Path == 1)
{
cout << "You wait for something to happen.After about 3 seconds the stranger lets out a laugh."<< endl;
cout<< " he walks over to them and talks for alittle before he tells you to come on." << endl << endl;
cout << "*You have escaped." << endl;
system ("pause");
system ("cls");
cout << "Three months later....." << endl << endl;
cout << " After getting to learn everyones name, you learn the stranger that helped you was named Rees" <<endl;
cout << " He has been getting people like you that were thrown in jail and training them for his cause." << endl;
cout << " The only thing he demands is the loyalty of his followers. If they didn't agree they went back to the slammer." << endl;
cout << " You swore your life to helping his cause of slaying monsters that would do good folks harm";
system ("pause");
system ("cls");
}
}
(btw: why do you have a getch() after your return statements?
The application ends at the return 0 so your getch is not needed (that's why I removed it)
Furthermore, conio is deprecated but I guess your teacher doesn't know that)
The problem is simple, you have 2 blocks where you ask for option 1 in the last part (line 112 & 146)
the statement gets catched on line 112, at the end of that if-block you have a return 0 which means the programm is over
Just remove the if-block from line 112-122 (133-150 in your code) and it will work
Thanks for the help gamer2015! I was really getting bugged i couldn't find it. You most likely just helped save me a huge grade because everyone in here was stumped.