Input loop isn't working properly

There is a loop from lines 750-970 that has 2 options in an if statement for when you input a string for the variable "input". When it asks you to input something it does the first option of "run" no matter what you type in. Could I please have help in solving this issue? I am shortening the code a bit so it fits in this post.
<
#include "stdafx.h"
#include "Main.h"
#pragma warning(disable : 4996)

using namespace std;
random_device rd;
CONSOLE_FONT_INFOEX cfi;

//VARIABLES
string input;
int facing;
int z5location;
bool z1first = true;
bool searchWreck = true;
int Wood;
int Cloth;
int Hydration = 100;
bool Flag = false;
bool loop = true;
int hp = 25;
bool z3death = false;

int z3();

int z3() {
if (z3death == true) {
cout << "You look up the hill, and see a heap near the ruin." << endl;
Sleep(3200);
cout << "As you get near you realize it's a dead body. ";
Sleep(2400);
cout << "Your dead body." << endl;
Sleep(3500);
cout << "You collect the items from your corpse and depart." << endl;
Sleep(2500);
system("CLS");
Sleep(1500);
cout << "Where would you like to go?" << endl;
while (true) {
cin >> input;
if (facing == 2) {
if (input == "left" || input == "goleft") {
cout << "You hike down the hill, shaken to the bones by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 1;
z4();
break;
}
else if (input == "back" || input == "goback" || input == "backwards" || input == "gobackwards") {
cout << "You hike down the hill, shaken to the bones by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 4;
z1();
break;
}
else {
cout << "No" << endl;
}
}
else if (facing == 3) {
if (input == "right" || input == "goright") {
cout << "You hike down the hill, shaken to the bones by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 4;
z1();
break;
}
else if (input == "back" || input == "goback" || input == "backwards" || input == "gobackwards") {
cout << "You hike down the hill, shaken to the bones by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 1;
z4();
break;
}
else {
cout << "No" << endl;
}
}
}
}
system("CLS");
cout << "Your hydration is now at " << Hydration << "%." << endl;
Sleep(2600);
cout << "As you near the ruin atop the hill you get an aweful feeling..." << endl;
Sleep(3800);
system("CLS");
Sleep(1000);
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 42;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
cout << "Something is wrong." << endl;
Sleep(2200);
system("CLS");
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 60;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
cout << "VERY";
Sleep(1750);
cout << " WRONG." << endl;
Sleep(1750);
system("CLS");
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 40;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
cout << "Your vision becomes strained, everything is getting dark, FEND IT OFF!" << endl;
Sleep(4200);
cout << "You fall to your knees and look behind you..." << endl;
Sleep(2400);
cout << "Something is there." << endl;
Sleep(1800);
system("CLS");
cout << "It's like a shadow made of thick strands of matter, its like it's \nthere but not there, shaped like a man nearly 8 feet tall." << endl;
Sleep(6300);
cout << "What do you do?!" << endl;
Sleep(1000);
cout << "Dear god!";
Sleep(750);
cout << " WHAT DO YOU DO?!" << endl;
while (true) {
cin >> input;
if (input == "run" || input == "escape" || input == "runaway" || "getaway" || input == "flee") {
system("CLS");
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 32;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
cout << "ERROR" << endl;
Sleep(1000);
cout << ".-- .... .- \n- / ....\n .- ...- . / -.-- --- ..-\n / -.. --- -. . \n..--.." << endl;

z3death = true;
Sleep(200);
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 32;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
system("CLS");
if (facing == 2) {
z1();
break;
}
else if (facing == 3) {
z4();
break;
}
}
else if (input == "attack" || input == "fight" || input == "charge" || input == "killit" || input == "kill") {
system("CLS");
cout << "You jump to your feet and charge at the shadow full speed!" << endl;
Sleep(2600);
cout << "You take the most powerful punch you can muster and swing with all your might!" << endl;
Sleep(4000);
cout << "Poof. It's gone. Along with your energy." << endl;
Sleep(2500);
cout << "You fall down face first." << endl;
Sleep(2500);
system("CLS");
Sleep(5000);
cout << "'What happened...?'" << endl;
Sleep(1700);
cout << "You pat yourself clean, and walk away." << endl;
while (true) {
cin >> input;
if (facing == 2) {
if (input == "left" || input == "goleft") {
cout << "You hike down the hill, shaken by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 1;
z4();
break;
}
else if (input == "back" || input == "goback" || input == "backwards" || input == "gobackwards") {
cout << "You hike down the hill, shaken by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 4;
z1();
break;
}
else {
cout << "No" << endl;
}
}
else if (facing == 3) {
if (input == "right" || input == "goright") {
cout << "You hike down the hill, shaken by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 4;
z1();
break;
}
else if (input == "back" || input == "goback" || input == "backwards" || input == "gobackwards") {
cout << "You hike down the hill, shaken by what you just experienced." << endl;
Sleep(3550);
Hydration -= 20;
hp++;
facing = 1;
z4();
break;
}
else {
cout << "No" << endl;
}
}
}
}
else {
cout << "HURRY UP AND DO SOMETHING!" << endl;
}
}
return 0;
}
int main() {

cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 32;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
std::wcscpy(cfi.FaceName, L"DINPro-regular");
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
z1();
return 0;
}
>
if (input == "run" || input == "escape" || input == "runaway" || "getaway" || input == "flee")


--->

if (input == "run" || input == "escape" || input == "runaway" || input == "getaway" || input == "flee")
There is a loop from lines 750-970 that has 2 options in an if statement ...


You have a loop that is 220 lines long inside a function. So the function is how many lines long? 225? 250? 700? 1000?

Functions that long are out of control.

A function should be a max of maybe 100 lines--less than 80 is better. If it is longer than that, it is much more difficult to understand and maintain.

Break your large, unwieldy function into smaller, more manageable bites and maintain that. A place to start is to take the code blocks from your if and else statements and make them stand-alone functions called from the if and else statements. Take the code block from the while loop and make it a stand-alone function that is called within the while loop. See where that gets you, and break it up some more if the functions are still too big.

The overhead of a function call is pretty small. It is definitely worth the overhead to make a huge function more manageable.
Registered users can post here. Sign in or register to post.