This is what I have thus far.
# include <iostream>
using namespace std;
double miles( double miles, double gallons, double mpg);
int main ()
{
const int ARRAYSIZE = 10; // fixed array with 10 items
double miles[ARRAYSIZE]={240.5, 300.0, 189.6, 310.6, 280.7, 216.9, 199.4, 160.3, 177.4, 192.3};
double gallons[ARRAYSIZE]={10.3, 15.6, 8.7, 14.0, 16.3, 15.7, 14.9, 10.7, 8.3, 8.4};
system("pause");
return 0;
}
double miles( double miles, double gallons, double mpg)
{
double mpg;
mpg = miles/gallons;
return mpg;
}
I need each element of the mpg array to calculate as the corresponding element of the miles array divided by the equivalent element of the gallons array. For example:
Mpg[0]=miles[0]/gallons[0]
I've been like working on this now for about 4 days, I am very lost and could really use the help.