C++ HELP, how can I make functions for the array in the main program, the array must stay in main?

I need separate functions to store data of water consumed in each month this is my program #include <iostream> #include <iomanip> #include <string> using namespace std; void data(double arr[], const string month [], const int s); int main() { const int MONTHS = 12; double consumption... show more I need separate functions to store data of water consumed in each month this is my program

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

void data(double arr[], const string month [], const int s);

int main()
{
const int MONTHS = 12;
double consumption [MONTHS];
string months [MONTHS] = {"January", "Febuary", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December"};

data(consumption, months, MONTHS);

return 0;
}

I have to write function data using a loop to ask user for amount of consumption each month and store data in consumption array
Update: void data(double array, const string m, const int size)
{
for (int count = 0; count < size; count++)
cout << "Enter amount of water consumption in CFF for " <<m [count]<<": ";
cin>> array[count];
}


my attempt at writing the function
2 answers 2