Hideki Snk

Hideki Snk

  • NA
  • 5
  • 0

only 4 integers allowed?

Oct 19 2007 7:40 AM
Hi,
here the question.. i wanted to knw if i can set the limit of the input that user can keyin only 4 integers number.. by default, i use this kind of code ..
input:
                Console.WriteLine("4 integers number");
            Console.Write("  User input: ");
            int j = int.Parse(Console.ReadLine());
            if ((j < 1000) || (j > 10000))
            {
                Console.Clear();
                Console.WriteLine("Error!!Please input 4 digit integers");
                goto input;
            }

by the way, if u see the code.. 0000-0999 cant be read since the condition is 1000-10000..
so is there anyway to solve this problem so that i can input 0000-0999?

Answers (1)