Bob103

CG-1(1)

May 4th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Height of mountain 0 : 9
  2. Height of mountain 1 : 8
  3. Height of mountain 2 : 7
  4. Height of mountain 3 : 3
  5. Height of mountain 4 : 6
  6. Height of mountain 5 : 5
  7. Height of mountain 6 : 2
  8. Height of mountain 7 : 4
  9.  
  10. int main()
  11. {
  12.  
  13. // game loop
  14. while (1) {
  15. for (int i = 0; i < 8; i++) {
  16. int mountainH;int max=0; // represents the height of one mountain, from 9 to 0.
  17. cin >> mountainH; cin.ignore();
  18.  
  19. if (mountainH >= max)
  20. // Write an action using cout. DON'T FORGET THE "<< endl"
  21. // To debug: cerr << "Debug messages..." << endl;
  22.  
  23. cout << i << endl; // The number of the mountain to fire on.
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment