예제 #1
0
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split();
            string   name   = input1[0] + " " + input1[1];
            Threeuple <string, string, string> tuple1 = new Threeuple <string, string, string>
                                                            (name, input1[2], input1[3]);


            string[] input2       = Console.ReadLine().Split();
            int      litersOfBeer = int.Parse(input2[1]);
            bool     drunk;

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

            Threeuple <string, int, bool> tuple2 = new Threeuple <string, int, bool>
                                                       (input2[0], litersOfBeer, drunk);


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

            Console.WriteLine(tuple1);
            Console.WriteLine(tuple2);
            Console.WriteLine(tuple3);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            var inputPersonInfo = Console.ReadLine()
                                  .Split(" ", StringSplitOptions.RemoveEmptyEntries);
            var inputPersonBeer = Console.ReadLine()
                                  .Split();
            var inputBankInfo = Console.ReadLine()
                                .Split();

            var fullName = inputPersonInfo[0] + " " + inputPersonInfo[1];
            var address  = inputPersonInfo[2];
            var town     = string.Join(" ", inputPersonInfo.Skip(3));

            var name       = inputPersonBeer[0];
            var liters     = int.Parse(inputPersonBeer[1]);
            var drunkOrNot = inputPersonBeer[2];
            var isDrunk    = drunkOrNot == "drunk" ? true : false;

            var personName = inputBankInfo[0];
            var balance    = double.Parse(inputBankInfo[1]);
            var bankName   = inputBankInfo[2];

            var personInfo = new Threeuple <string, string, string>(fullName, address, town);
            var personBeer = new Threeuple <string, int, bool>(name, liters, isDrunk);
            var bankInfo   = new Threeuple <string, double, string>(personName, balance, bankName);

            Console.WriteLine(personInfo);
            Console.WriteLine(personBeer);
            Console.WriteLine(bankInfo);
        }
예제 #3
0
        static void Main(string[] args)
        {
            var inputPersonInfo = Console.ReadLine().Split();

            var name       = $"{inputPersonInfo[0]} {inputPersonInfo[1]}";
            var address    = inputPersonInfo[2];
            var town       = inputPersonInfo[3];
            var personInfo = new Threeuple <string, string, string>(name, address, town);


            var inputPersonBeer = Console.ReadLine().Split();

            var nameBeer     = inputPersonBeer[0];
            var beerInLiters = int.Parse(inputPersonBeer[1]);
            var isDrunk      = inputPersonBeer[2] == "drunk" ? true : false;
            var amountOfBeer = new Threeuple <string, int, bool>(nameBeer, beerInLiters, isDrunk);

            var inputNumbers = Console.ReadLine().Split();

            var personName = inputNumbers[0];
            var doubleNum  = double.Parse(inputNumbers[1]);
            var bank       = inputNumbers[2];
            var numbers    = new Threeuple <string, double, string>(personName, doubleNum, bank);

            Console.WriteLine(personInfo);
            Console.WriteLine(amountOfBeer);
            Console.WriteLine(numbers);
        }
예제 #4
0
        static void Main(string[] args)
        {
            string[] line  = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var      tupel = new Threeuple <string, string, string>($"{line[0]} {line[1]}", line[2], line[3]);

            Console.WriteLine(tupel);

            line = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            bool drunk;

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

            var tupel2 = new Threeuple <string, int, bool>(line[0], int.Parse(line[1]), drunk);

            Console.WriteLine(tupel2);

            line = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var tupel3 = new Threeuple <string, double, string>(line[0], double.Parse(line[1]), line[2]);

            Console.WriteLine(tupel3);
        }
예제 #5
0
        public static void Main(string[] args)
        {
            var    input    = Console.ReadLine().Split(' ');
            string name     = input[0] + " " + input[1];
            string adress   = input[2];
            string town     = input[3];
            var    strTuple = new Threeuple <string, string, string>(name, adress, town);

            Console.WriteLine(strTuple);

            var    secInput     = Console.ReadLine().Split(' ');
            string secName      = secInput[0];
            int    litersOfBeer = int.Parse(secInput[1]);
            bool   drunkOrNot   = false;

            if (secInput[2] == "drunk")
            {
                drunkOrNot = true;
            }
            var strIntTuple = new Threeuple <string, int, bool>(secName, litersOfBeer, drunkOrNot);

            Console.WriteLine(strIntTuple);

            var    thirdInput     = Console.ReadLine().Split(' ');
            string thridName      = thirdInput[0];
            double accBalance     = double.Parse(thirdInput[1]);
            string bankName       = thirdInput[2];
            var    intDoubleTuple = new Threeuple <string, double, string>(thridName, accBalance, bankName);

            Console.WriteLine(intDoubleTuple);
        }
예제 #6
0
        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);
        }
예제 #7
0
파일: StartUp.cs 프로젝트: dradkov/SoftUni
        static void Main(string[] args)
        {
            var inputInfo = Console.ReadLine().Split();

            var tupleOne = new Threeuple <string, string, string>((inputInfo[0] + " " + inputInfo[1]), inputInfo[2], inputInfo[3]);

            inputInfo = Console.ReadLine().Split();


            var tupleTwo = new Threeuple <string, int, bool>(inputInfo[0], int.Parse(inputInfo[1]), inputInfo[2] == "drunk" ? true : false);

            inputInfo = Console.ReadLine().Split();

            var tupleThree = new Threeuple <string, double, string>(inputInfo[0], double.Parse(inputInfo[1]), inputInfo[2]);


            Console.WriteLine(tupleOne);
            Console.WriteLine(tupleTwo);
            Console.WriteLine(tupleThree);
        }
예제 #8
0
        private static void Main(string[] args)
        {
            //1. Tuple
            //var input1 = Console.ReadLine().Split(' ');
            //Tuple<string, string> tuple1 = new Tuple<string, string>(input1[0] + " " + input1[1], input1[2]);
            //
            //var input2 = Console.ReadLine().Split(' ');
            //Tuple<string, int> tuple2 = new Tuple<string, int>(input2[0], int.Parse(input2[1]));
            //
            //var input3 = Console.ReadLine().Split(' ');
            //Tuple<int, double> tuple3 = new Tuple<int, double>(int.Parse(input3[0]), double.Parse(input3[1]));
            //
            //tuple1.Print();
            //tuple2.Print();
            //tuple3.Print();

            //2. Treeple

            var input1 = Console.ReadLine().Split(' ');
            Threeuple <string, string, string> threpple1 = new Threeuple <string, string, string>(input1[0] + " " + input1[1], input1[2], input1[3]);

            var  input2 = Console.ReadLine().Split(' ');
            bool drunkOrNot;

            if (input2[2] == "drunk")
            {
                drunkOrNot = true;
            }
            else
            {
                drunkOrNot = false;
            }
            Threeuple <string, int, bool> threpple2 = new Threeuple <string, int, bool>(input2[0], int.Parse(input2[1]), drunkOrNot);

            var input3 = Console.ReadLine().Split(' ');
            Threeuple <string, double, string> threpple3 = new Threeuple <string, double, string>(input3[0], double.Parse(input3[1]), input3[2]);

            threpple1.Print();
            threpple2.Print();
            threpple3.Print();
        }
예제 #9
0
        static void Main(string[] args)
        {
            var input            = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();
            var firstAndLastName = input[0] + " " + input[1];
            var address          = input[2];
            var town             = input[3];

            if (input.Count == 5)
            {
                town += " " + input[4];
            }

            var firstTuple = new Threeuple <string, string, string>(firstAndLastName, address, town);

            Console.WriteLine(firstTuple);

            input = Console.ReadLine().Split().ToList();
            var  name    = input[0];
            var  beer    = int.Parse(input[1]);
            bool isDrunk = false;

            if (input[2] == "drunk")
            {
                isDrunk = true;
            }

            var secondTuple = new Threeuple <string, int, bool>(name, beer, isDrunk);

            Console.WriteLine(secondTuple);

            input = Console.ReadLine().Split().ToList();
            name  = input[0];
            var balance    = double.Parse(input[1]);
            var bankName   = input[2];
            var thirdTuple = new Threeuple <string, double, string>(name, balance, bankName);

            Console.WriteLine(thirdTuple);
        }
예제 #10
0
        static void Main(string[] args)
        {
            string[] nameAdress = Console.ReadLine()
                                  .Split(" ")
                                  .ToArray();
            string name   = nameAdress[0] + " " + nameAdress[1];
            string street = nameAdress[2];

            string[] cityArr = nameAdress.Skip(3).ToArray();
            string   city    = $"{string.Join(" ", cityArr)}";

            string[] alcoholCheck = Console.ReadLine()
                                    .Split(" ")
                                    .ToArray();
            string nameTwo = alcoholCheck[0];
            int    age     = int.Parse(alcoholCheck[1]);
            string status  = alcoholCheck[2] == "drunk" ? "True" : "False";

            string[] bankAccount = Console.ReadLine()
                                   .Split(" ")
                                   .ToArray();
            string nameThree = bankAccount[0];
            double amount    = double.Parse(bankAccount[1]);
            string code      = bankAccount[2];

            Threeuple <string, string, string> lineOne
                = new Threeuple <string, string, string>(name, street, city);

            Threeuple <string, int, string> lineTWo
                = new Threeuple <string, int, string>(nameTwo, age, status);

            Threeuple <string, double, string> lineThree
                = new Threeuple <string, double, string>(nameThree, amount, code);

            Console.WriteLine(lineOne.ToString());
            Console.WriteLine(lineTWo.ToString());
            Console.WriteLine(lineThree.ToString());
        }