I have a method here that allows the user to enter any number except for 999. But I don't know how to create a validation when user enters a negative number or letter.
static int EnterScores(double[] scores, int maxScores)
{
double userInput;
int count = 0;
while (count < maxScores)
{
Console.Write("Enter a score(or 999 to quit): ");
userInput = double.Parse(Console.ReadLine());
if (userInput == 999 || userInput < 0)
break;
scores[count++] = userInput;
}
return count;
}