So I'm currently working on a program that does the following tasks:
Read the encoded message from the attached MessageIn.txt file using StreamReader
Count the instance of each character in the file,
The most common character in the message should be an "E". Use this information to calculate the amount of the shift,
Print out the decoded message.
I've got the whole importing part but i'm having a lot of problems figuring out how to take the contents of the text file and put it into an array, then using that array to determine the most common character that appears.
Here's what i've got so far to import the text file:
private static StreamReader inFile;
static void Main(string[] args)
{
string inValue;
try
{
inFile = new StreamReader("MessageIn.txt"); //assumes the text file in the in bin Debug or Release folder
while ((inValue = inFile.ReadLine()) != null)
{
}
}
catch (System.IO.IOException exc)
{
Console.WriteLine("ERROR");
}
}
}
Someone please give me some guidance on where to go next. Much appreciated!