Jump to content
  • Advertisement
Sign in to follow this  
nooblet

C++ Help

This topic is 4370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am using Bloodshed Dev C++ and I have a question. If I am making a DOS text-based RPG, how would I add an experience thing. Such as.. say you fight a monster, then how do I add it to where it will add a random number between 1-10 to my experience and display it?

Share this post


Link to post
Share on other sites
Advertisement
Here are 2 functions that calculate a random int and float between 2 values:


int RandomInt(int iMin, int iMax)
{
int iDiff = iMax - iMin;
return ( rand() % (iDiff+1) ) + iMin;
}

float RandomFloat(float fMin, float fMax)
{
float fRandom = (float)rand() / RAND_MAX;
return ( (fMax - fMin) * fRandom ) + fMin;
}


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!