Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- const int CAP = 5;
- int cakeArray[CAP] {0,};
- int pancake;
- int mostCake = 0;
- int index = 0;
- cout << "how many pancakes did he eat?\n";
- for(int i = 1; i <= CAP; i++)
- {
- cin >> pancake;
- cakeArray[i] = i;
- cout << cakeArray[i] << endl;
- if(mostCake < pancake)
- {
- cakeArray[index] += i;
- mostCake = pancake;
- cout << mostCake << "most \n";
- }
- }
- cout << cakeArray[mostCake] << " " << cakeArray[index];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement