コード例 #1
0
ファイル: Program.cs プロジェクト: GeorgiPanaiotov/GenericsEx
        static void Main(string[] args)
        {
            string[] firstInput = Console.ReadLine().Split();
            Threeuple <string, string, string> threeuple1 = new Threeuple <string, string, string>();

            if (firstInput.Length == 5)
            {
                Threeuple <string, string, string> threeupleOne = new Threeuple <string, string, string>(firstInput[0] + " " + firstInput[1]
                                                                                                         , firstInput[2]
                                                                                                         , firstInput[3] + " " + firstInput[4]
                                                                                                         );
                threeuple1 = threeupleOne;
            }
            else
            {
                Threeuple <string, string, string> threeupleOne = new Threeuple <string, string, string>(firstInput[0] + " " + firstInput[1]
                                                                                                         , firstInput[2]
                                                                                                         , firstInput[3]
                                                                                                         );
                threeuple1 = threeupleOne;
            }

            string[] secondInput = Console.ReadLine().Split();
            bool     isDrunk     = false;

            if (secondInput[2] == "drunk")
            {
                isDrunk = true;
            }
            else
            {
                isDrunk = false;
            }

            Threeuple <string, int, bool> threeuple2 = new Threeuple <string, int, bool>(secondInput[0], int.Parse(secondInput[1])
                                                                                         , isDrunk
                                                                                         );

            string[] thirdInput = Console.ReadLine().Split();

            Threeuple <string, double, string> threeuple3 = new Threeuple <string, double, string>(thirdInput[0], double.Parse(thirdInput[1])
                                                                                                   , thirdInput[2]
                                                                                                   );

            Console.WriteLine(threeuple1);
            Console.WriteLine(threeuple2);
            Console.WriteLine(threeuple3);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: slavi00/Softuni-Exercises
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split();
            Threeuple <string, string, string> tuple1 = new Threeuple <string, string, string>(input[0] + " " + input[1], input[2], input[3]);

            Console.WriteLine(tuple1);

            input = Console.ReadLine().Split();
            bool isDrunk = input[2] == "drunk" ? true : false;
            Threeuple <string, int, bool> tuple2 = new Threeuple <string, int, bool>(input[0], int.Parse(input[1]), isDrunk);

            Console.WriteLine(tuple2);

            input = Console.ReadLine().Split();
            Threeuple <string, double, string> tuple3 = new Threeuple <string, double, string>(input[0], double.Parse(input[1]), input[2]);

            Console.WriteLine(tuple3);
        }