...

Exercise: High Scores

You're building a 5-player game that tracks their high scores in an array. When a player beats their previous score, you need to update the array, but only if the new score is valid.

Requirements

  1. Check if the player number is valid (between 1 and 5)
  2. If the player number is not between 1-5, print: "You entered an incorrect player number"
  3. Check if the new score is actually higher than the current score
  4. If the new score is less than or equal to the current score, print: "The new high score should be more than the current score of XX" (where XX is the actual current score)
  5. If everything is valid, update the high score in the array and print: "Updated high scores: " followed by the array

Remember: Player numbers are 1-5, but array indexes are 0-4.

Variables

No variables

Loading...

Output (Console)