This message was edited by uchetex at 2003-9-30 8:28:47
: I have edited your GetScore method, to make it recursive. It will now only allow you to enter a score between 0 and 100 and it also double checks that you are entering a number. I hope this code points you in the right direction. It may not be exactly what you are looking for but I really hope it helps.
:
: static float GetScore(int Count)
: {
: string T;
:
: Console.Write("Enter score number {0}: ", Count + 1);
: T = Console.ReadLine();
:
: try
: {
: float s = float.Parse(T);
: if (s < 0 || s > 100)
: {
: Console.Write("\nI am sorry but you have entered an incorrect score.\nPlease enter a score between 0 and 100.\n\n");
: return GetScore(Count--);
: }
: else
: return s;
: }
: catch (Exception e)
: {
: Console.WriteLine("\nI am sorry but you have not entered a proper value\n");
: return GetScore(Count --);
: }
: }
:
:
:
Eric Maino
:
GVSU Microsoft SA
:
:
Emaino, That was exactly what I was looking for. But one more thing is how can the user enter a -1 to end the programm