I have tried putting finalcom=20 and the cout right next to in different places, and I never seem to get the result that I want. Sometimes it will make finalcom=40 or something instead of 20 and it won't display You ecounter a man. How do I fix this stuff?? Someone told me to put the finalcom=20 at the end,but then what if the person pushed 2 for goblin instead of one?Code:case 'f':
while(monster<1 || monster>4){
cout<<"1-man\n";
cout<<"2-goblin\n";
cin>>monster;
if(monster=='1'){
finalcom=20;
cout<<"You encounter a man";
}
}
while(finalcom>0){ //fight
fight=rand()%6;
cin>>combat;
if(combat=='a'){ //attack
fcom=(((strength*3)+agility)/fight);
finalcom=mhp1-fcom;
mhp1=finalcom;
}
if(finalcom>0){
cout<<finalcom<<"\n";
}
}
cout<<"\nHe is dead\n";