Rpg game

i have been working on a rpg game and im trying to use a menu anf if staments for the items and attack useing loops 1 can this work this way and 2 im getting error in my code and i cant find it.

#include<iostream>
#include<cstdlib>
#include<iomanip>//for rand
#include<ctime> //time
using namespace std;
int main()

char Fight;

cout<<"Press F to fight ";
cout<<"or Press any key for Quit"<<endl;
cin >>Fight;

if(put_out_fire == 'F' || put_out_fire == 'f')/////story my continues in here//////
{

// static unsigned long Gobling_Damage = 1;

///////weapons & Damage///
double Sword_of_Might = 3;
double Flint_Gun = 4;
double Small_Dagger = 1;
double Granade = 6;
double health = 100;
double health_potion_level_1 = 10;
double Nature_Damage = 2;
double Gobling_Damage;
double Gobling_health = 60;
double Damaged_health;
//////////////////////////

int rand,choice;
char S ,H, N;


{


//monster always attaks first

do (Gobling_health > 0)

{

Gobling_Damage = 1 + rand() 10;

cout<<"your health "<<health<<endl;
cout<<"the Gobling "<<Gobling_health<<endl;


cout<<"The Goblin did"<<Gobling_Damage<<"that hurts"<<endl;

health = Gobling_Damage - Damaged_health ;

cout<<"your health is "<<health<<endl;

system("pause");

}
cout<<"pick a weapon and fight or he will kill you!"<<endl;

cout<<"S:Small Dagger attack 1"<<endl;
cout<<"H:health potion health +10"<<endl;
cout<<"N:Nature Spell attack 2"<<endl;
cout<<"pick or die"<<endl;
cin >>choice;


}

}

else cout<<"You have failed do anything to save your friends or your city"<<endl;

return 0;

}






also it's going to be a final fanisy fighting type of game but with out the timers for attack, how do u use the menu to use wepons and attack the monster
and for the moster attack you back till him or i are dead? can some one point me in the right direction.
The do statement need a while at the end...
1
2
3
do{
   //your code here
}while(statement);

Or you can use just the while-loop:
1
2
3
while(statement){
   //your code
}


When you call rand() you probably want a number between 1 and 10. The correct form is (rand() % 10) + 1; You have to use modulo.

To use tha rand() function you have to include <cmath> not <iomanip>.

Last you can't have a variable named "rand" because you overide the librarys function rand().

You use the variable "put_out_fire" in your first if... You probably ment to use "Fight".

About the weapons you can use a function that displays a menu, about the weapons, and returns an int or char that represent the weapon the user chose.

And you forgot to open a bracket for main int main(){
Hope this helps
Last edited on
thanks this code is just one part of a much bigger code iv been working on this past few hours but im still confused on how the monster was going to take damage and i was to take damage or even heal. ill work on it some more today your comment helped.
Topic archived. No new replies allowed.