//The following calculates the average of three numbers.
#include <iostream>
#include <cstdio>
#include <cstdlib>
float val1, val2, val3, valSum;
int calculate ()
{
valSum = val1 * val2 * val3 / 3;
}
int main ()
{
std::cout << "Please enter your tree numbers: ";
cin >> val1 >> val2 >> val3;
switch (calculate);
cout << "The average is: " << valSum;
return 0;
}
Read about how to properly make and call a function here http://www.cplusplus.com/doc/tutorial/functions/
Also your use of global variables breaks any encapsulation that the function would otherwise provide, which by the way should be returning an int based on your calculate function's signature.