Frank

Frank

  • NA
  • 16
  • 22.7k

I need help with an error I keep getting to create an array.

Dec 3 2010 9:24 PM
I'm new to C# previously taken a class but didn't learn anything from it.

The error I'm getting says "Cannot Implicitly convert type 'int' to 'int[]'

Here's the code.
             int[] intArray;

            for (int i = 0; i < 26; i++)
            {
                intArray = 100; //This is where it says the problem is.
            }

            intArray[4] -= 8;
            intArray[0] -= 13;
            intArray[25] -= 2;
            intArray[21] -= 1;
            intArray[12] -= 67;
            intArray[8] -= 32;
            intArray[9] -= 50;

            int sum = 0;

            for (int i = 0; i < 26; i++)
            {
                sum += intArray[i];
            }

            int average = 0;

            average = sum / 26;

            Console.WriteLine("Average Score: " + average);


Answers (1)