示例#1
0
        static void Main(string[] args)
        {
            PrintService <string> ps = new PrintService <string>();

            Console.Write("How many values? ");
            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string x = Console.ReadLine();
                ps.AddValue(x);
            }

            ps.Print();
            Console.WriteLine("First: " + ps.First());
        }
    {   // o programa principal deve ser alterado para string se quiser rodar string
        static void Main(string[] args)
        {
            PrintService printService = new PrintService();

            Console.WriteLine("Quantos valores você irá digitar ? ");
            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                int x = int.Parse(Console.ReadLine());
                printService.AddValue(x);
            }

            printService.Print();
            Console.WriteLine("Primeiro: " + printService.First());
        }
示例#3
0
        static void Main(string[] args)
        {
            PrintService <string> pr = new PrintService <string>();

            Console.Write("How many values? ");
            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                string number = Console.ReadLine();
                pr.AddValue(number);
            }

            pr.Print();
            Console.WriteLine("First: " + pr.First());
        }