Having Issues with program need assistance

Problem: Quest 3 continually repeats

#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<ctime>
#include<stdlib.h>
#include <fstream>

int main()
{
int Quest, race, ritem, mitem, sitem, aitem, health;
string answer, name;
double playthrough = 0, character;


cout << "Welcome to Our RPG SCIFI game Here you will enter your character name\n";
cout << "Please enter your Characters name\n";
cin >> name;
system("pause");
system("cls");

if(playthrough == 0)
{
// toonName(name);
race1();
character = race1();


Quest = 1;
if(Quest == 1)
{

Quest1(name);
Quest++;
}
if(Quest == 2)
{
Quest2(race, name, health, ritem);
Quest++;
}
if(Quest == 3)
{
Quest3(name);
Quest++;
}
if(Quest == 4)
{
Quest4(name);
Quest++;

}
if(Quest == 5)
{
finalPart1(name);
finalPart2(name);
}
}
cin.get();
cin.ignore();
return 0;
}




double Quest3(string name)
{
unsigned x = 0, y = 0, z = 0;
int choice, easywayOut = 0, terminated = 0, checkpointHP, HP, simpleQ, HitPoints;
char Again = 'Y', fruit;
char riddle = 'a';
string FRiddle;
srand((unsigned)time(0));

HP = HitPoints;
checkpointHP += HP;

while (Again == 'y' || Again == 'Y')
{
HP = checkpointHP;
cout << name << " is traveling to Angel's homeland to obtain the Lexicon.\n"
<< "You come accross a river and you have two options.\n"
<< "1. Risk swimming accross the river.\n"
<< "2. Walk a mile to the next bridge and safely cross the river.\n(You can only take the easy way out once.)\n"
<< "To choose enter 1 or 2\n\n";
cin >> choice;
system ("cls");
// **********************************************
if (choice == 1)
{
system ("cls");
x = 1 + rand() % 2;
cout << "You chose to risk swimming accross the river.\n";
if (x == 1)
{
system ("cls");
cout << "You got accross the river without getting hurt.\n";
cin.get();
cin.ignore();
}
if (x == 2)
{
system ("cls");
z = 1 + rand() % 50;
cout << "The current was too strong and took you downstream. You hit many rocks while being pushed downstream and took " << z << " damage.\n";
HP -= z;
cin.get();
cin.ignore();
}
}
if (choice == 2)
{
system ("cls");
cout << "You chose the safest route possible and got accross the river without being hurt.\n"
<< "You can no longer choose the safe route";
cin.get();
cin.ignore();
easywayOut = 1;
}
if (HP <=0)
{
system ("cls");
cout << "You took too much damage and died.\n"
<< "Respawn at beggining? (Y/N)\n";
cin >> Again;
}
// **********************************************
x = 0, y = 0, z = 0; // Reset random gen variables.
// **********************************************
if (HP > 0) // Make sure player isn't dead.
{
system ("cls");
cout << "You come accross some fruit that can possibly restores some of your health.\n"
<< "There is a 50/50 chance that it is bad for you.\n"
<< "Will you chance it and eat it? (Y/N)\n";
cin >> fruit;

if (fruit == 'Y' || fruit == 'y')
{
x = 1 + rand() % 2;
if (x == 1)
{
system ("cls");
cout << "The fruit was good and restored 25 HP.\n";
cin.get();
cin.ignore();
}
if (x == 2)
{
system ("cls");
cout << "The fruit was bad and you lost 25 HP.\n";
cin.get();
cin.ignore();
HP -= 25;
}
if (fruit == 'Y' || fruit == 'y' && HP <= 0)
{
system ("cls");
cout << "The fruit killed you.\n"
<< "Respawn at beggining? (Y/N)\n";
cin >> Again;
}
}
if (fruit == 'N' || fruit == 'n')
{
system ("cls");
cout << "Hmmm...Not much of a risk taker are you?\n";
cin.get();
cin.ignore();
cout << "What always runs but never walks, often murmurs, never talks, has a bed but never sleeps, has a mouth but never eats?\n";
getline(cin, FRiddle);
if (FRiddle != "river" && FRiddle != "River" && FRiddle != "a river" && FRiddle != "A river")
{
cout << "Hmm...Not all that smart either?\n"
<< "What's 2 + 2?";
cin >> simpleQ;
if (simpleQ == 4)
{
cout << "Good job....\n\n";
cin.get();
cin.ignore();
}
else
{
cout << "Terrible, just terrible.\n\n";
cin.get();
cin.ignore();
}
}
}
}
// **********************************************
x = 0, y = 0, z = 0; // Reset random gen variables.
// **********************************************
if (HP > 0)
{
int count = 1;
while (riddle != 'e' || riddle != 'E' && count <=3)
{
system ("cls");
cout << "You come accross a bridge and can see Angel's homeland. You start to cross the \nbridge when a troll pops out and starts trolling you\n"
<< "You have to answer his riddle to pass the bridge and get to Angel's homeland.\n"
<< "\n\n"
<< "I am the beginning of the end, and the end of time and space. I am essential to creation, and I surround every place. What am I?\n";
if (count == 2)
{
cout << "HINT: It is commonly used in words\n";
}
if (count == 3)
{
cout << "HINT: It is part of the alphabet.\n";
}
cin >> riddle;
count++;
// Answer is the letter E.
}
if (count == 3)
{
system ("cls");
cout << "You did not answer the riddle correctly and the troll killed you.\n"
<< "Respawn at beggining? (Y/N)\n";
cin >> Again;
HP = 0;
}
}
}
// **********************************************
if (riddle == 'e' || riddle == 'E' )
{
system ("cls");
cout << "You answered the riddle correctly.\n";
cout << "You got to Angel's homeland alive and obtained the Lexicon.\n";
return 0;r
}

}
a ton more to the code program is 2000 lines of code just this particular quest im having a major issue with for some reason no matter what try quest 3 just reverts back to the beginning of it as soon as you enter E or e for the riddle as well as when i try to implement a way to cin >> name to pass through each function in the main it will not even register that im trying to do that just skips over the cin
Topic archived. No new replies allowed.