Question: C++ - I'm having trouble understanding why the function isn't being recognized after being called. The function is to get the total of the array

C++ - I'm having trouble understanding why the function isn't being recognized after being called. The function is to get the total of the array totalMonthlyRainfall. I posted the text code below the image. Thank you for your help.

C++ - I'm having trouble understanding why the function isn't being recognized

#include

using namespace std;

void monthlyRainfallInput(string[], double[], int);

double totalMonthlyRainfall(double, int);

int main() {

const int MONTHS = 12;

string months[MONTHS] = {"Jan", "Feb", "March", "Apr", "May", "June", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

double monthlyRainfall[MONTHS];

monthlyRainfallInput(months, monthlyRainfall, MONTHS );

totalMonthlyRainfall(monthlyRainfall, MONTHS);

return 0;

}

//Function that collects rainfall amount and puts into array

void monthlyRainfallInput(string months[], double monthlyRainfall[], int MONTHS){

for (int x = 0 ; x

cout

cin >> monthlyRainfall[x];

}

for (int x = 0 ; x

cout

}

}

//Function that calculates total rainfall

double totalMonthlyRainfall(double monthlyRainfall[], int MONTHS){

int total = 0;

for (int x = 0; x

total = total + monthlyRainfall[x];

}

return total;

}

12 #include > monthlyRainfall[x]; for (int x = 0 ; x

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!