#include <iostream>
using namespace std;
const int monkeys = 3;
const int weekdays = 7;
double monkeyWeek[monkeys][weekdays];
double largest;
double least;
double average;
int index;
int dayCount;
double amount;
double amountEaten(double[] [weekdays], int);
double mostEaten (double[] [weekdays],int);
double leastEaten (double[][weekdays], int);
int main(){
cout << "Ch 7-4 Monkey " << endl;
cout << "Created by Aaron Roberts" << endl;
double mostBananas (double[] [weekdays],int);
double leastBananas (double[][weekdays],int);
//double bananaAverage (double[][weekdays], int);
}
double amountEaten(double array[] [weekdays], int){
cout << "Please enter the amount of food eaten per monkey per day." << endl;
double amount = array[0][0];
for (index = 0; index < monkeys; index++)
{
for (dayCount = 0; dayCount < weekdays; dayCount++)
{
cout << endl <<"Please enter the amount of pounds eaten by monkey"
<<(index +1)
<< endl << "for day " << (dayCount +1) << ": ";
cin >> monkeyWeek[monkeys] [weekdays] ;
if (monkeyWeek[monkeys] [weekdays] < 1)
cout << endl <<"Must feed positive amount" << endl;
}
}
}
double mostEaten( double array[] [weekdays], int size)
{
double largest = array[0][0];
for (int count = 0; count < size; count++)
{
for (int col = 0; col < count; col++)
{
if (array[count][weekdays] > largest)
largest = array[count][weekdays];
}
}
return largest;
}
double leastEaten(double array[] [weekdays], int size)
{
double least = array[0][0];
for (int count = 0; count < size; count++)
{
for (int col = 0; col < size; col++);
{
if (array[count][weekdays] < least)
least = array[count][weekdays];
}
}
return least;
}
This project requires the utilization of a 2 dimensional array to store the pounds of food eaten by 3 monkeys each of the seven days of the week.
Create a function to obtain the pounds eaten for each monkey, each day of the week. Create a second function to determine pass through the array to calculate the total all of the moneys ate, and then the average eaten on one day. (Some of you interpretted this as sum all values, then divide by number of values. Others interpretted this as summing the values for each day and calculating the average for that day. So, there would be 7 lines of output, not just one.)
Create a third function to determine which monkey ate the least amount of food and on what day. Also output the amount the monkey ate on that day. Create a fourth function to determine which monkey ate the most amount of food on a single day. Output the monkey number, the pounds eaten, and the weekday.
I'm new at c++ and stuck and don't really know how to complete this. Thanks for any help i really appreciate it.