I just need some help with a simple problem.. I'm trying to learn C++ as i want to get into game programming, I have previous programming experience, but not in C++.. My question comes a little like this. I'm making a dummy console application where it will take the numbers of your current XYZ and compare it to a box of coords.. [x1,z1,y1 / x2,y2,z2] and check if you're within this area.. now i can do that on its own.. my question is, How would you write up something that would allow you to reuse this function but have a different output, Eg if its within X box then do X, if its in Y box then do Y .. This is what i currently have..
void withinRange(int x1, int y1, int z1, int x2, int y2, int z2)
{
if (cCoordx > x1 && cCoordy > y1 && cCoordz > z1 && cCoordx < x2 && cCoordy < y2 && cCoordz < z2)
{
}
}
I'm not really sure how to expand on this to make it able to be a reusable function..