Currently working on a project where I have two arrays (one 1-D and another 2-D). One contains names and another contains a set of numbers. I'm working on a function that finds the lowest value in the table and outputs it. However, I need to attribute the name of the monkey to the amount of food he has eaten. So "Monkey 1 has eaten the least amount of food only eating 11 pounds on Day 1". Below is the function to find the lowest value which is working fine, however I'm not sure how to implement the monkey's name (without just typing it in) and the day of the week. If the rest of my code is needed please let me know.
void leastAmt(string names, int food[NUM_DAYS])
int lowest = food;
for (int monkey = 0; monkey < NUM_MONKEYS; monkey++)
for (int day = 0; day < NUM_DAYS; day++)
if (food[monkey][day] < lowest)
lowest = food[monkey][day];
cout << "Least amount of food: " << lowest << endl;
create two variables for storing monkey and money values.
int lowest_monkey, least_day;
Whenever lowest value is modified update these values with current values of monkey and day variables. Replace the last line with the following
cout << "Monkey " << lowest_monkey << " has eaten least amount of food only eating " << lowest << " on " << least_day << endl;