Keith

Keith

  • NA
  • 36
  • 0

Check for Repetition in Array with foreach loop

Jul 31 2007 12:11 AM

I'm writing a program that could store 100 customer ID in an array.
Using foreach loop to check, If same ID exist more than 3 times, it will prompt for error.
Can anyone please help me with this, thanks;

            int[] Cid = new int[5];

            for (int i = 0; i < 100; i++)
            {
                Console.Write("Customer ID: ");
                Cid[i] = int.Parse(Console.ReadLine());

                foreach(int d in Cid)
                {
                    if (??? Cid in array more than 3 times ???)
   Console.WriteLine("YOU HAVE EXCEEDED NUMBER OF ID");
                       
                }
            }


Answers (5)