0

Monkey Business

Hello I have completed this program, I have The average amount of food eaten per day by the whole family of monkeys. The least amount of food eaten during the week by one monkey and The greatest amount of food eaten during the week by one monkey, however i still need a solution for The pounds of food that should be order for the next week, can I please get help? //C++ Program Monkey Business //Gabriel Reyes February 2, 2022 #include <iostream> #include <iomanip> using namespace std; int main() { const int mkys = 10; const int days = 7; int food[mkys][days]; double pounds, least, most, sum = 0; int rec_avg = 2; // Ask user to input data for each monkey cout << "INPUT AMOUNT OF POUNDS THE MONKEY EATS.\n"; for (int row = 0; row < mkys; row++) { for (int col = 0; col < days; col++) { do { cout << "Monkey #" << (row + 1) << " on day #" << (col + 1) << " ate: "; cin >> pounds; if (pounds > 6) { cout << "THE NUMBER MUST BE LESS THAN 6, PLEASE TRY AGAIN.\n"; } } while (pounds > 6); food[row][col] = pounds; // Get total food eaten per day by the whole family of monkeys. sum += pounds; } cout << endl; // make blank space } // Get least and greatest amount of food eaten by any one monkey. least = most = food[0][0]; for (int row = 0; row < mkys; row++) { for (int col = 0; col < days; col++) { if (food[row][col] < least) { least = food[row][col]; } if (food[row][col] > most) { most = food[row][col]; } } } { cout << "\n Monkey Weekly Food Report\n" << " by the whole family of monkeys\n" << "----------------------------------------------------\n"; cout << fixed << setprecision(1); cout << "Average amount of food eaten per day : " << sum / 7 << " pounds.\n"; cout << "Least amount of food eaten: " << least << " pounds.\n"; cout << "Greatest amount of food eaten: " << most << " pounds.\n";

3rd Feb 2022, 5:59 PM
Gabriel Reyes
1 Respuesta
0
Could you copy+paste your program into a "code bit" and link it instead of pasting into the message? https://www.sololearn.com/discuss/2975017/?ref=app https://www.sololearn.com/discuss/2975370/?ref=app
3rd Feb 2022, 8:48 PM
HungryTradie
HungryTradie - avatar