using System; using System.Diagnostics; using System.Text; namespace automata1starter { class Program { static void Main(string[] args) { double your_CPU = 3.7; // please change this value wth your CPU frequency in GHz Stopwatch stopwatch = Stopwatch.StartNew(); // the code to measure the running time int lineNumber = 0; // indicates the line number string filename; if (args.Length < 1) { filename = "c:\\users\\ali\\documents\\visual studio 2015\\Projects\\automata1starter\\automata1starter\\2600-0-no-accents.txt"; // this is the default file name which I assume is placed here, correct the address if you want } else filename = args[0]; // the file name is passed as the comman line argument to the program // Now, I am going to open the file and read it line by line System.IO.StreamReader file = null; try { // openning the file file = new System.IO.StreamReader(filename); string line; // reading file line by line while ((line = file.ReadLine()) != null) { lineNumber++; // do not forget that our line numbers starts at 1 Console.WriteLine(line); Console.WriteLine(lineNumber); Console.WriteLine('\n'); /****************************** Write your code in the following lines ******************************/ } } catch (Exception e) { // either the file does not exist or something bad happened Console.WriteLine(e.Message); } finally { // do not forget to free resources if (file != null) file.Close(); } // finish the work stopwatch.Stop(); Console.WriteLine("\n******************\nTotal runtime in milliseconds: {0}\nYour score of runtime is {1}", stopwatch.ElapsedMilliseconds, stopwatch.ElapsedMilliseconds * your_CPU); Console.ReadKey(); } } }