Sign in to follow this  

Please help me

Recommended Posts

Pancake Glutton
variables, data types, and numerical operators
basic input/output
logic (if statements, switch statements)
loops (for, while, do-while)

Write a program that asks the user to enter the number of pancakes eaten for breakfast by 10 
different people (Person 1, Person 2, ..., Person 10)
Once the data has been entered the program must analyze the data and output which person ate the most pancakes for breakfast.

? Modify the program so that it also outputs which person ate the least number of pancakes for breakfast.

#include <iostream>
using namespace std;

int main()
    const int MAX_ASK = 10;
    int person[MAX_ASK],cakes[MAX_ASK],leastcake;
    for (int i = 0; i < MAX_ASK; i++)
        cout << "Enter cake eaten by person " << i << " : ";
        cin >> cakes[i];
        cout << endl;
    for (int j = 0; j < MAX_ASK; j++)
                leastcake = cakes[0];
                if(cakes[j] > leastcake)
                   leastcake = cakes[j];

            cout << "Least cake eaten is: " << leastcake << endl;
        return 0;
Not getting proper result

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this