I've been playing with the notion of making my own game engine and these are some starter functions I wrote for in game stats.

percentage

Code: C++
double percent(double n,double d)
{
return n / d * 100;
}


ratio

Code: C++
double ratio(double n,double d)
{
return n / d;
}