1
Answer

How do I compare these 2 arrays?

Ask a question
Carol

Carol

15y
2.2k
1
I'm just learning C# and I need to compare these 2 arrays and display which ones do not match according to the user's input of A,B,C,D. Can someone please help me out?

Here's what I have so far.

static void Main()
        {
            char[] exArray = new char[20] { 'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A' };
            char[] usArray = new char[20];

            Console.WriteLine("Please enter your answers for each exam question.");

            for (int a = 0; a < 20; a++)
            {
                Console.Write("Question #{0}: ", (a + 1));

                usArray[a] = Convert.ToChar(Console.ReadLine());

            }

do I use another for loop to compare the 2 or do i use a method and call both arrays in?

Answers (1)