Help with program just closing

closed account (23h0pfjN)
#include <iostream>
#include <unistd.h>
#include "windows.h"



using namespace std;

void stats(int HP,int atk,int def);
void items(string item);
void Skebattle(int HP, int atk, int def, string monster);

int main()
{
string Ppas;
string Apas;
string Tpas;
string Kpas;
string monster;
int Pepas;
int HP = 50;
int atk = 0;
int def = 2;
string dress = "Dress";

cout << "Padaryta Dominyko Litvaicio (RoterDOX), ver 0,1" << endl;
Sleep(2500);
cout << "Text RPG" << endl;
Sleep(2500);
cout << "You meet a mysterious man in a cave" << endl;
Sleep(2500);
cout << "He tells you a tale about a dragon that attacked his city." << endl;
Sleep(2500);
cout << "He went to this cave and hided until now." << endl;
Sleep(2500);
cout << "He wants you to kill the dragon, and let him rebuild the city." << endl;
Sleep(2500);
cout << "He gives you a sword that increases your atack(atk) +5." << endl;
Sleep(2500);
atk +=5;
cout << "To see your stats write in /stats." << endl;
Sleep(2500);
cout << "If you want to continue just write /con" << endl;
cin >> Ppas;
if(Ppas == "/stats"){
stats(HP, atk, def);
}
if(Ppas == "/con"){

}
cout << "You leave the old and mysteriuos man, and venture deeper in to the cave." << endl;
Sleep(2500);
cout << "While walking you see a dead body." << endl;
Sleep(2500);
cout << "You could loot it white the command: /loot" << endl;
cin >> Tpas;
if(Tpas == "/loot"){
items(dress);
cout << "Would you like to equip it? Then just write /equip (item name)." << endl;
cin >> Kpas;
if(Kpas == "/equip"){
cout << "You are now wearing a dress that gives you +2 def" << endl;
def +=2;
}
if(Kpas == "/con"){

}
if(Tpas == "/con"){

}
Sleep(2500);
cout << "You go deeper into the cave." << endl;
Sleep(2500);
cout << "You see a walking Skeleton !" << endl;
Sleep(2500);
cout << "The Skeleton looks at you and charges you!!" << endl;
Sleep(2500);
cout << "What should you do?" << endl;
Sleep(2500);
cout << "1.Attack the skeleton. \n2.Try to run away." << endl;
Sleep(2500);
cout << "Write the number of your choise: ";
cin >> Pepas;
if(Pepas == 1){
Skebattle(HP, atk, def, "Skeleton");
}
if(Pepas == 2){

}


}
cin >> Apas;
}
void Skebattle(int HP, int atk, int def, string monster){
int attackType = 0;
int iDamage = 0;
int damageG;
cout << "You decide to attack the " << monster << endl;
Sleep(2500);
while(iDamage<=50){
cout << "1.Do a strong attack, 2.Do a AOE attack: ";
cin >> attackType;
cout << "You chose attack Nr." << attackType << endl;
iDamage = 50 - 5 + atk;
cout << "You attacked the monster and inflicted: " << iDamage << " damage." << endl;
Sleep(2500);
damageG = HP + def - 8;
cout << "The " << monster << " attacked you and inflicted: " << damageG << " damage." << endl;
}

}
void stats(int HP,int atk,int def){
cout << "Hp: " << HP << endl;
cout << "atk: " << atk << endl;
cout << "def: " << def << endl;
}
void items(string item){
cout << "You looted the body and got:" << endl;
cout << item << endl;
}
The problem is that when the code reaches this part:
cout << "If you want to continue just write /con" << endl;
when it goes to this cin >> Pepas;
then it stop and no errors are showing please help me :D
Last edited on
Topic archived. No new replies allowed.