Code:
void main ()
{
...
return 0;
}
int main, not void main.
It would be more consistent (in C++) to use <cstdio> instead of <stdio.h>.
Code:
float average = addUP (x, y, z-20)/3;
cout << " the average of " << x << " " << y << " and " << z << " is " << average;
Very confusing to the user, you are displaying the average x, y, z-20 but you are telling them the average is of x, y, z. If they try to do the math themselves as an error check (based on what you've told them you are averaging), they're going to be confused.
Code:
#include <iostream>
...
cout << "the first function is addition " << addUP (3,4,12) << endl;
...
cout << " the average of " << x << " " << y << " and " << z << " is " << average;
cout and endl are in the std namespace so you'd have to take that into account, so either:
- Write using namespace std; somewhere after your #include statements.
- Put using std::cout; using std::endl; statements somewhere before their use in your code.
- Preface all of those items with std:: in your code.