Code:
//A simple text based rpg designed to be a fun and lighthearted game.
#include <iostream>
using namespace std;
int main(void)
{
struct cractr {
int dmg;
int spd;
int hp;
int regen;
int intel;
int res;
int exp;
int head;
int arm;
int leg;
int heart; };
cractr player = { 1, 1, 15, 1, 1, 0, 0, 5, 5, 5, 5 };
cractr cat = { 1, 6, 1, 1, 4, 8, 0, 3, 3, 3, 3 };
int choice = 0, fish = 0, blood = 0, carrot = 0, gold = 0, done = 0;
int boss1 = 0, boss2 = 1, boss3 = 1, boss4 = 1, boss5 = 1, boss6 = 1, boss7 = 1, boss8 = 1, boss9 = 1, boss10 = 1, boss11 = 1, boss12 = 1, boss13 = 1, boss14 = 1, boss15 = 1, boss16 = 1, boss17 = 1;
unsigned char i = 0, ii = 0, iii = 0, iv = 0, v = 0, vi = 0, vii = 0, viii = 0, ix = 0;
cout << "You have been brought into existence as a mortal...\nbut you can leave it a hero,\nif you would only try...";
cin.get();
cout << "\nYou wish to fight the demons, I see.\nWell, you're going to need some bait first!\nHere's a fishing rod;\nit will be all you need to get started off.\n";
cin.get();
while (boss17 = 1) {
cout << "What will you do today?\nFish(1) Hunt(2) Move on(3)\n";
cin >> choice;
if (choice == 1) {
cout << "You obtain a fish.\n"; fish++; }
else if (choice == 2)
{
cout << "Ah, so you wish to hunt for\nthe demons and become stronger.\nWhich demon shall you fight?\nCat(1)\n";
cin >> choice;
if (choice == 1 && fish > 0) {
cout << "You shall battle a cat!\n";
i = 213;
ii = 94;
iii = 32;
iv = 184;
v = 179;
vi = 48;
vii = 95;
viii = 212;
ix = 190;
cout << i << ii << iii << ii << iv << "\n";
cout << v << vi << iii << vi << v << "\n";
cout << v << iii << vii << iii << v << "\n";
cout << viii << vii << vii << vii << ix << "\n";
}
else if (choice == 1 && fish == 0)
cout << "You lack the necessary type of bait.\n";
}
if (choice == 3)
cout <<" You wish to leave your current area?\nThen you must battle a gate demon.\nAre you sure you are ready?\nYes(1) No(2)";
return 0;
}
}
After I do anything once (such as fishing or trying to hunt) it exits the program. This makes me assume that it is exiting the while loop. I tried putting cin.get(); right after the while loop ends, and it doesn't even read it. I don't put anything in to the cin.get(); command before it is instantly closed.