Beispiel #1
0
        public static void Main(string[] args)
        {
            string[] personInfo     = Console.ReadLine().Split().ToArray();
            string[] personBeerInfo = Console.ReadLine().Split().ToArray();
            string[] bankInfo       = Console.ReadLine().Split().ToArray();

            string personFullName = personInfo[0] + " " + personInfo[1];
            string personAddress  = personInfo[2];
            string personTown     = string.Join(" ", personInfo.Skip(3));

            string personBeerName    = personBeerInfo[0];
            int    amountOfBeer      = int.Parse(personBeerInfo[1]);
            bool   conditionOfPerson = personBeerInfo[2] == "drunk" ? true : false;

            string personName     = bankInfo[0];
            double accountBalance = double.Parse(bankInfo[1]);
            string bankName       = bankInfo[2];

            Threeuple <string, string, string> personThreeuple     = new Threeuple <string, string, string>(personFullName, personAddress, personTown);
            Threeuple <string, int, bool>      personBeerThreeuple = new Threeuple <string, int, bool>(personBeerName, amountOfBeer, conditionOfPerson);
            Threeuple <string, double, string> bankThreeuple       = new Threeuple <string, double, string>(personName, accountBalance, bankName);

            Console.WriteLine(personThreeuple);
            Console.WriteLine(personBeerThreeuple);
            Console.WriteLine(bankThreeuple);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var firstLine      = Console.ReadLine().Split();
            var name           = firstLine[0] + " " + firstLine[1];
            var address        = firstLine[2];
            var town           = firstLine[3];
            var firstThreeuple = new Threeuple <string, string, string>(name, address, town);

            var secondLine    = Console.ReadLine().Split();
            var name2         = secondLine[0];
            var littersOfBeer = int.Parse(secondLine[1]);
            var isDrunk       = false;

            if (secondLine[2] == "drunk")
            {
                isDrunk = true;
            }
            var secondThreeuple = new Threeuple <string, int, bool>(name2, littersOfBeer, isDrunk);

            var thirdLine      = Console.ReadLine().Split();
            var name3          = thirdLine[0];
            var accountBalance = double.Parse(thirdLine[1]);
            var bankName       = thirdLine[2];
            var thirdThreeuple = new Threeuple <string, double, string>(name3, accountBalance, bankName);

            Console.WriteLine(firstThreeuple.ToString());
            Console.WriteLine(secondThreeuple.ToString());
            Console.WriteLine(thirdThreeuple.ToString());
        }