Skip to content
Snippets Groups Projects
Commit b056b23d authored by Rudi Buss's avatar Rudi Buss
Browse files

Update Solution Exercise 4 - Dungeon.cpp

parent f899df78
No related branches found
No related tags found
No related merge requests found
#include <stdlib.h>
#include <ctime>
#include <iostream>
......@@ -48,7 +50,6 @@ void Player::setpotionOfLife() {
bool Player::getpotionOfLife() { return potionOfLife; }
int main() {
bool flee = false;
int defeat_Creatures = 0;
int selection;
int randomHealthPoints;
......@@ -67,7 +68,6 @@ int main() {
switch (selection) {
case 1: {
int tmp = 0;
system("cls");
monster = new Creature(); // New creature appears
srand(time(NULL)); // initialize generator to generate random numbers
......@@ -112,7 +112,8 @@ int main() {
}
} while (true);
system("pause");
cin.ignore();
cin.get();
break;
}
case 2: {
......@@ -121,17 +122,21 @@ int main() {
player->setpotionOfLife();
else
cout << "There is no potion of life available." << endl;
system("pause");
cin.ignore();
cin.get();
break;
}
case 3: {
cout << endl << "You have fled!" << endl;
cout << "Number of defeated creatures: " << defeat_Creatures << endl;
cin.ignore();
cin.get();
break;
}
default: {
cout << endl << "Invalid selection!" << endl;
system("pause");
cin.ignore();
cin.get();
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment