Advertisement
Guest User

asd

a guest
Sep 23rd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. const int CAP = 5;
  8. int cakeArray[CAP] {0,};
  9. int pancake;
  10. int mostCake = 0;
  11. int index = 0;
  12.  
  13. cout << "how many pancakes did he eat?\n";
  14.  
  15. for(int i = 1; i <= CAP; i++)
  16. {
  17. cin >> pancake;
  18. cakeArray[i] = i;
  19. cout << cakeArray[i] << endl;
  20. if(mostCake < pancake)
  21. {
  22. cakeArray[index] += i;
  23. mostCake = pancake;
  24. cout << mostCake << "most \n";
  25. }
  26. }
  27. cout << cakeArray[mostCake] << " " << cakeArray[index];
  28.  
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement