this is the function that's coming up with the most errors
double getHighestRainfall(double arrayOfNumbers, double SIZE)
{
double highest;
highest = arrayOfNumbers[0];
for(int count = 0; count > highest ; count++)
{
if(arrayOfNumbers[count] > highest)
{
highest = arrayOfNumbers[count];
}
}
return highest;
}
#include <iostream>
using namespace std;
//function prototypes
double getLowestValue(double arrayOfNumbers, double SIZE);
double takeAverage(double arrayOfNumbers, double average);
double getLowestValue(double arrayOfNumbers, double SIZE);
double getHighestRainfall(double arrayOfNumbers, double SIZE);
double getTotalRainfall(double arrayOfNumbers[], double SIZE);
//global variables and constants
double average;
const double SIZE = 12;
double arrayOfNumbers[12];
double TOTAL = 0;
string myMonths[];
//main function
int main ()
{
//declare the string for months
string myMonths[12] = { "January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December"};
double arrayOfNumbers[12];
//get values to store in array
for(int count = 0; count < SIZE; count++)
{
cout << "Enter values to store in " << myMonths[count] << ": ";
cin >> arrayOfNumbers[count];
}
//print the total rainfall
cout << "The total rainfall is: " << getTotalRainfall(arrayOfNumbers,
SIZE);
//print the average rainfall
cout << "The average rainfall is: " << takeAverage(average, SIZE);
//print the least rainfall
cout << "The least rainfall is: " << getLowestValue(arrayOfNumbers, SIZE);
return 0;
}
the errors:
test2.cpp:66:39: error: no matching function for call to 'getLowestValue'
cout << "The least rainfall is: " << getLowestValue(arrayOfNumbers, SIZE);
BenedictionsMBP:MyCppFiles benedictionbora$ g++ test2.cpp
test2.cpp:16:8: error: definition of variable with array type needs an explicit size or an initializer
string myMonths[];
^
test2.cpp:47:39: error: no matching function for call to 'getLowestValue'
cout << "The least rainfall is: " << getLowestValue(arrayOfNumbers, SIZE);
^~~~~~~~~~~~~~
test2.cpp:6:8: note: candidate function not viable: no known conversion from 'double [12]' to 'double' for 1st argument
double getLowestValue(double arrayOfNumbers, double SIZE);
^
test2.cpp:102:29: error: subscripted value is not an array, pointer, or vector
highest = arrayOfNumbers[0];
~~~~~~~~~~~~~~^~
test2.cpp:105:22: error: subscripted value is not an array, pointer, or vector
if(arrayOfNumbers[count] > highest)
~~~~~~~~~~~~~~^~~~~~
test2.cpp:107:29: error: subscripted value is not an array, pointer, or vector
highest = arrayOfNumbers[count];
~~~~~~~~~~~~~~^~~~~~