You guys Rock!!!
Thank you so much nicholasjb1996 and fiji885!!
Now back to the "drawing board" I need to analyse everything!
this forum rulz ,so glad I have registered...thanx again you guys and thank you cpp forum for having me!!
edit;
@fiji885
I`v got a compiler error saying that "else" statement must start with the "if" statement!
@nicholasjb1996
it ends fine if I fall into the pit, but it doesn`t continue when I encounter a Troll! It all ends after "return 0"!
edit2;
found a solution,with your help guys,thank you so much!!! (please, feel free to comment anything)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
using namespace std;
int main()
{
int steps;
int dmg;
int hp1 = 250;
std::cout << "Welcome to Horror House!\n";
std::cout << "Step into the dark...how many steps will you dare take?\n";
std::cin >> steps;
if(steps <= 10) {
std::cout << "You encoutered a Troll!!!\n" << "click some damage: \n";
std::cin >> dmg;
if(dmg >= hp1) {
std::cout << "You killed the Troll!!!\n";
}
else {
std::cout << "You have been killed\n" << "GAME OVER!!!\n";
}
}
if(steps > 10) {
std::cout << "You fell into the pit\n" << "GAME OVER!!!\n";
}
return 0;
}
|
now I will try to add some new things,will get back to you! You have been a great help!!
any kind of advice or help in the future will be appreciated...Thanx a bunch!!!!
tried to play some more and man,now it reall gets messed up!
how the he** can I end statements properly in different scenarios like this one,
I tried to follow c++ statement rules,but I for sure doing something wrong!?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
using namespace std;
int main()
{
int steps;
int dmg;
int hp1 = 250;
int hp2 = 150;
std::cout << "Welcome to Horror House!\n";
std::cout << "Step into the dark...how many steps will you dare take?\n";
std::cin >> steps;
if(steps <= 10) {
std::cout << "You encoutered a Troll!!!\n" << "click some damage: \n";
std::cin >> dmg;
if(dmg >= hp1) {
std::cout << "You busted Troll`s head open!!!\n";
std::cout << "continue in the dark,click some Steps: \n";
std::cin >> steps;
}
else {
std::cout << "You have been killed\n" << "GAME OVER!!!\n";
}
if(steps >= 5){
std::cout << "You fell deeeeeeep.....\n" << "GAME OVER!!!\n";
}
else{
std::cout << "Giant SPIDER!!!\n" << "click some damage: \n";
std::cin >> dmg;
}
if(dmg >= hp2){
std::cout << "SPIDER KILLED!!\n";
}
else{
std::cout << "you have been killed by a SPIDER!!!\n";
}
if(steps > 10) {
std::cout << "You fell into the pit\n" << "GAME OVER!!!\n";
}
return 0;
}}
|