Here is the main section im having problems with.
from line 72 to 136 is the first time you speak to your father.
from line 137 to 172 is where you have the option to speak to your father after exploring. so if you choose to speak to your father after exploring all the code from 72 to 136 is repeated.
#include <iostream>
#include <cstdlib>
#include <string>
usingnamespace std;
int main()
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"| (WELCOME TO THE QUEST OF TIEOPIA!) |" << endl;
cout <<"------------------------------------------------------------------------" << endl;
system("pause");
int choice;
bool gameOn = true;
while (gameOn != false){
cout <<"------------------------------------------------------------------------\n";
cout << " 1 - Start the game.\n";
cout << " 2 - Story.\n";
cout << " 3 - Help.\n";
cout << " 4 - Exit.\n";
cout << "Choice : ";
cin >> choice;
cout <<"------------------------------------------------------------------------" << endl;
if (choice == 1)
{
string Cname;
cout << "game start!\n" << endl;
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Date:354 AD. Location:Tieopia." << endl;
cout <<"" << endl;
cout <<"Since the begining of time, there has been a proficy." << endl;
cout <<"That a young warrior would rise and defeat the king of Tieopia." << endl;
cout <<"Many have foulishly thought that they were the warrior that the" << endl;
cout <<"proficy spoke of. Each one traveld far and fought countless enemies. " << endl;
cout <<"But in the end they all were unsuccesful... " << endl;
cout <<"" << endl;
cout <<"" << endl;
cout <<"------------------------------------------------------------------------" << endl;
system("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout << "What do you want your characters name to be? ";
cin >> Cname;
system("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout <<"You are standing in the main room of your hut." << endl;
cout <<"Infront of you is your mother." << endl;
int choice;
cout <<"Choose 1 to talk to your mother. Choose 2 to kill" << endl;
cout <<"your mother. \nChoice: ";
cin >>choice;
if(choice == 1)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"(Your mother) Hi " << Cname << endl;
cout <<"You need to speak to your father." << endl;
cout <<"He is out by the granary." << endl;
}
if(choice == 2)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Good job now your mother is dead and you dont know what to do." << endl;
system("pause");
return 0;
}
system("pause");
int choice1;
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Now that you have spoken to your mother, you may" << endl;
cout <<"go see your father or explore the area around your" << endl;
cout <<"hut." << endl;
cout <<"Choose 1 to talk to your father" << endl;
cout <<"Choose 2 to explore the area around your hut." << endl;
cout <<"Choice: ";
cin >>choice1;
if(choice1 == 1)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"(Your father)Hey " << Cname << endl;
cout <<"It's about time you woke up." << endl;
system ("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout <<"I need you to help me." << endl;
cout <<"Will you?" << endl;
int choice3;
cout <<"If you would like to help your father choose: 1" << endl;
cout <<"If you would not like to help your father choose 2:" << endl;
cout <<"Choice: ";
cin >>choice3;
if(choice3 == 1)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"(Your father) Ok good, I need you to go to the wheat field" << endl;
cout <<"and get some wheat for the horses." << endl;
int choice4;
cout <<"Would you like to go to the wheat feild?" << endl;
cout <<"Choose 1 for yes " << endl;
cout <<"Choose 2 for no" << endl;
cin >>choice4;
if(choice4 == 1)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"You go to the wheat feild and get some wheat." << endl;
cout <<"------------------------------------------------------------------------" << endl;
cout <<"You return to your father with the wheat." << endl;
cout <<"(You) Here is the wheat you asked for father." << endl;
cout <<"(Your father) Thank you, " << Cname << endl;
system ("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Tell you what son, since you helped me ill tell you" << endl;
cout <<"a secret. Dont tell your mother I told you this." << endl;
cout <<"I know how much you love to explore and discover.." << endl;
cout <<"Its killing you being here in this town isnt it?" << endl;
cout <<"I know, I can see it in your eyes." << endl;
cout <<"But anyway since you helped me ill tell you the password" << endl;
cout <<"to the gate that leads out of this town." << endl;
system ("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout <<"The password is: perfectcircle." << endl;
cout <<"Be careful out there son, there is danger around every corner." << endl;
cout <<"Oh I almost forgot, your older brother wants to talk to you." << endl;
cout <<"He is in the barn." << endl;
system("pause");
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Now that you have spoken to your father you may choose" << endl;
cout <<"to go to the barn where your brother is, or go to the gate." << endl;
int choice5;
cout <<"Choose 1 to go to the barn and speak to your brother." << endl;
cout <<"Choose 2 to go to the gate." << endl;
cout <<"Choice: ";
cin >> choice5;
if (choice5 == 1)
{
}//chose to go to the barn and speak to your brother.
}//chose to go to the wheat feild
if(choice4 == 2)
{
}//chose to not go to the wheat feild
}//chose to help your father
if(choice3 == 2)
{
}//chose to not help your father
}//chose to speak to your father
if(choice1 == 2)
{
cout <<"------------------------------------------------------------------------" << endl;
cout <<"You walk outside your hut." << endl;
cout <<"To your right is the grannary." << endl;
cout <<"Where your father is." << endl;
cout <<"To your left is the barn." << endl;
cout <<"In front of you is the garden and wheat feild." << endl;
system ("pause");
int choice2;
cout <<"------------------------------------------------------------------------" << endl;
cout <<"Where would you like to go?" << endl;
cout <<"To go to the granary choose: 1" << endl;
cout <<"To go to the barn choose: 2" << endl;
cout <<"to go to the garden & wheat field choose: 3" << endl;
cout <<"Choice: ";
cin >>choice2;