Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // game loop
- while (true)
- {
- int maxVal = -1;
- int maxIndex = 0;
- for (int i = 0; i < 8; i++)
- {
- int mountainH = int.Parse(Console.ReadLine()); // represents the height of one mountain.
- if(mountainH > maxVal)
- {
- maxVal = mountainH;
- maxIndex = i;
- }
- }
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- Console.WriteLine(maxIndex); // The index of the mountain to fire on.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement