Help with Functions program

I'm having trouble with an assignment for my online class, and I'd really appreciate your help. If you guys could just get me on the right track, that would be very helpful.

Program filename: functions.cpp

Create a New Project and call it Functions. Then rename your main.cpp file to functions.cpp. The program should ask the user for three doubles and one Fahrenheit temperature.

Description: Incorporate each of the functions described below into a single program (function.cpp). For each function, do this:

•Declare a function prototype
•Display which function is being called
•Display the parameters of the function call
•Display the results of the function
The functions are:

double mean(double a, double b, double c)
//returns the average of a, b, and c.

double maximum(double a, double b, double c)
//returns the largest of a, b, and c.

double minimum(double a, double b, double c)
//returns the smallest of a, b, and c.

double median(double a, double b, double c)
//returns the middle number of a, b, and c.

double ftoc (double a)
//returns the Celsius equivalent of a
// °C = 5 * ( °F – 32) / 9


Sample Output:
calling mean(4.3 , 9.325 , 6.58)
mean returned 6.735

calling maximum(4.3 , 9.325 , 6.58)
maximum returned 9.325

etc...

Other Information: Put a blank line between function results in the output for better readability.

What do you need help with? The directions are pretty clear and even provides the function prototypes for you.
Give us some direction as to what you need Johnson.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Meanwhile in main()
cout << "Maximum function\n"
        << "Parameters: double" << a << " double " 
        << b << " double " << c << "\n"
        << "Result: " << maximum(first,second,last)
        << endl;
//Repeat this for the other functions.
//...
//...

//One of your functions.
double maximum(double a, double b, double c)
{
  double result;
  //Do your calculations here.
 return result;
}


etc.. Should be a very simple program. If your professor requires you to gather input there are a few ways to do it. And you can put that either in main or your existing functions, though doing it in main within a loop of some kind would be better structure.
Last edited on
Topic archived. No new replies allowed.