I am trying to understand functions in my C++ class and i was wondering what would be an algorithm to evaluate function and find its maximum and minimum. If someone could explain this to me i would greatly appreciate.

I'm assuming you mean the mathematical kind of function, and finding the absolute maximum and absolute minimum, if they exist.

Basically unless you want to parse some strings you can code the math function directly in a C++ function, such as this:

int ComputeValue(int x){
  //f(x)= x + 3
  return x + 3;

Now, to use that function you insert an X-value much like a graphing calculator would, and it returns the Y-value. I'll leave the rest up to you.