I this program when input is catch-22 relevant output is "not found". Please fix the error.
Also whether it is possible to use Array.IndexOf in this program.
using System;
using System.Collections; //needed to do case insensitive search
public class DebugSix04
{
public static void Main()
{
String[] books = { "Rich Dad", "Poor Dad", "Catch-22", "Harry Potter", "Programming Using C#", "Wizard of Oz", "The Deep" };
IComparer comparer = new CaseInsensitiveComparer(); //lower case input will be realized as upper case letter
Array.Sort(books, comparer);
Console.Write("What book are you looking for? ");
string enterBookName = Console.ReadLine();
int x = Array.BinarySearch(books, enterBookName, comparer);
if (x < 0)
Console.WriteLine("{0} not found", enterBookName);
else
Console.WriteLine("Yes, we carry {0}", books[x]);
Console.ReadKey();
}
}