Exemple #1
0
        static void Main(string[] args)
        {
            PrintService <string> printService = 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();
                printService.addValue(x);
            }
            printService.Print();
            Console.WriteLine("Firts: " + printService.Firts());
        }
    {   // 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());
        }
Exemple #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());
        }