Array problem

Pages: 12
1
2
3
4
   for (person=1; person <= 10; person++)
    {
        cout << "Enter the number of pancakes eaten by person " << person << endl;
        cin >> pancakes [person];


Get used to arrays indexing starting at 0.

1
2
    MAX = pancakes[0];
    MIN = pancakes[0];


index 0 is undefined.

If you want your program to work properly with the questionably layout of arrays you must set max and min to panckaes[1] not 0.
Last edited on
Topic archived. No new replies allowed.
Pages: 12