Esempio n. 1
0
        public void Run()
        {
            // Open the names file and access the data
            using (StreamReader file = new StreamReader("C:/Users/HP/Dropbox/Academic_Desk/ProgramCode/csharpSection12/Assignment-3/Assignment-3/names.txt"))
            {
                int    counter = 0;
                string ln;

                while ((ln = file.ReadLine()) != null)
                {
                    names.Enqueue(ln);
                    counter++;
                }
                file.Close();
                Console.WriteLine($"File has {counter} lines.");
                // post condition of while is:
                // we now have a Data Member named names which is a Queue!!!!!
                PlayingWithStacks.Run(names);
            }
        }
Esempio n. 2
0
        public void Run()
        {
            // Open the names file and access the data
            using (StreamReader file = new StreamReader("U:/Users/700242/assignment3/700242assignment3/700242assignment3/names.txt"))
            {
                int    counter = 0;
                string ln;

                while ((ln = file.ReadLine()) != null)
                {
                    names.Enqueue(ln);
                    counter++;
                }
                file.Close();
                Console.WriteLine($"File has {counter} lines.");
                // post condition of while is:
                // we now have a Data Member named names which is a Queue!!!!!
                PlayingWithStacks.Run(names);
            }
        }