THANKS SMIRC!!!

that's perfect!
exactly what i was looking for.

btw, if anyone wants to use smirc's code, you might have to add:

#include <math.h>

for the power function. (i had to with visual c++)