Take the following code and add the function definition to compute the
average of four integers. The function declaration and main function are
already complete.
#include <iostream>
using namespace std;
// Average takes 4 integers and returns the average
double average(int a, int b, int c, int d);
int main()
{
int a, b, c, d;
double avg;
cout << "Enter 4 integers: ";
cin >> a >> b >> c >> d;
avg = average(a, b, c, d);
cout << "The average is " << avg << ".\n";
return 0;
}
When logged into Helios, you can copy a file containing this code by doing
cp /usr/users/mdanfor/public_html/cs221-f06/lab4_2.cpp .
You can also view the file here: lab4_2.cpp