Esempio n. 1
0
        void Start()
        {
            Pencil pencil = new Pencil();

            Console.Write("Enter a word : ");
            string userInput = Console.ReadLine();

            while (userInput != "stop")
            {
                pencil.Write(userInput);
                Console.Write("\nEnter a word : ");
                userInput = Console.ReadLine();
            }

            Console.WriteLine("\nend of program");
            Console.ReadKey();
        }
        void Start()
        {
            //First, we create a pencil and a pencil sharpener.
            Pencil          pencil    = new Pencil(20);
            PencilSharpener sharpener = new PencilSharpener();
            string          message   = "";

            while (message != "stop")
            {
                Console.Write("Enter a Word: ");
                message = Console.ReadLine();

                if (message == "sharpen")
                {
                    sharpener.Sharpen(pencil);
                }
                else if (message != "stop")
                {
                    pencil.Write(message);//**
                }
            }
            Console.WriteLine("End of the program.");
        }