Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions