コード例 #1
0
        public static void Main()
        {
            string[] input1 = Console.ReadLine()
                              .Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] input2 = Console.ReadLine()
                              .Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] input3 = Console.ReadLine()
                              .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            string names       = input1[0] + " " + input1[1];
            string address     = input1[2];
            string town        = string.Join(" ", input1.Skip(3));
            var    nameAddress = new Threeuple <string, string, string>(names, address, town);

            string name           = input2[0];
            double litersBeer     = double.Parse(input2[1]);
            bool   drunk          = !input2[2].Contains("not");
            var    nameLitersBeer = new Threeuple <string, double, bool>(name, litersBeer, drunk);

            string man           = input3[0];
            double balance       = double.Parse(input3[1]);
            string bank          = input3[2];
            var    integerDouble = new Threeuple <string, double, string>(man, balance, bank);

            Console.WriteLine(nameAddress);
            Console.WriteLine(nameLitersBeer);
            Console.WriteLine(integerDouble);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string[] firstInput = Console.ReadLine().Split();

            string names   = $"{firstInput[0]} {firstInput[1]}";
            string address = firstInput[2];
            string town    = firstInput[3];

            Threeuple <string, string, string> firstThreeuple = new Threeuple <string, string, string>(names, address, town);

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

            string name    = secondInput[0];
            int    num     = int.Parse(secondInput[1]);
            bool   isDrunk = secondInput[2] == "drunk" ? true : false;

            Threeuple <string, int, bool> secondThreeuple = new Threeuple <string, int, bool>(name, num, isDrunk);

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

            string lastName = thirdInput[0];
            double balance  = double.Parse(thirdInput[1]);
            string bank     = thirdInput[2];

            Threeuple <string, double, string> lastThreeuple = new Threeuple <string, double, string>(lastName, balance, bank);

            Console.WriteLine(firstThreeuple);
            Console.WriteLine(secondThreeuple);
            Console.WriteLine(lastThreeuple);
        }
コード例 #3
0
        public static void Main()
        {
            var personData = Console.ReadLine()
                             .Split()
                             .ToArray();

            string personName    = $"{personData[0]} {personData[1]}";
            string personAddress = personData[2];
            string personTown    = personData[3];

            var personInfo = new Threeuple <string, string, string>(personName, personAddress, personTown);

            Console.WriteLine(personInfo);

            var drunkPersonData = Console.ReadLine()
                                  .Split()
                                  .ToArray();

            string drunkPersonName        = drunkPersonData[0];
            int    drunkPersonLiterOfBeer = int.Parse(drunkPersonData[1]);
            bool   isDrunk = IsPersonDrunk(drunkPersonData[2]);

            var drunkPersonInfo = new Threeuple <string, int, bool>(drunkPersonName, drunkPersonLiterOfBeer, isDrunk);

            Console.WriteLine(drunkPersonInfo);

            var accountBalanceData = Console.ReadLine()
                                     .Split()
                                     .ToArray();

            string username       = accountBalanceData[0];
            double accountBalance = double.Parse(accountBalanceData[1]);
            string bankName       = accountBalanceData[2];

            var accountBalanceInfo = new Threeuple <string, double, string>(username, accountBalance, bankName);

            Console.WriteLine(accountBalanceInfo);
        }