static void Main(string[] args) { for (int i = 0; i < 3; i++) { var input = Console.ReadLine().Split(" ").ToArray(); switch (i) { case 0: var name = $"{input[0]} {input[1]}"; var adress = input[2]; var tuple = new Threeuple <string, string, string>(name, adress, input[3]); Console.WriteLine(tuple); break; case 1: var anotherName = input[0]; var status = input[2]; var isDrunk = status == "drunk" ? true : false; var tuple1 = new Threeuple <string, int, bool>(anotherName, int.Parse(input[1]), isDrunk); Console.WriteLine(tuple1); break; case 2: var someName = input[0]; var accountBalance = double.Parse(input[1]); var tuple2 = new Threeuple <string, double, string>(someName, accountBalance, input[2]); Console.WriteLine(tuple2); break; } } }
static void Main(string[] args) { //Adam Smith Wallstreet New York string[] firstTupleData = Console.ReadLine().Split(" "); string fullName = $"{firstTupleData[0]} {firstTupleData[1]}"; List <string> townRowData = firstTupleData.ToList().Skip(3).ToList();//so we can take New York, not only New string town = string.Join(" ", townRowData); Threeuple <string, string, string> firstThreeuoke = new Threeuple <string, string, string>(fullName, firstTupleData[2], town); string[] secondTupleData = Console.ReadLine().Split(" "); bool drunk = secondTupleData[2] == "drunk" ? true : false; Threeuple <string, int, bool> secondThreeuoke = new Threeuple <string, int, bool>(secondTupleData[0], int.Parse(secondTupleData[1]) , drunk); string[] thirdTupleData = Console.ReadLine().Split(" "); Threeuple <string, double, string> thirdThreeuoke = new Threeuple <string, double, string>(thirdTupleData[0], double.Parse(thirdTupleData[1]) , thirdTupleData[2]); Console.WriteLine(firstThreeuoke); Console.WriteLine(secondThreeuoke); Console.WriteLine(thirdThreeuoke); }
public static void Main() { string[] inputOne = Console.ReadLine().Split(); var tupleOne = new Threeuple <string, string, string>($"{inputOne[0]} {inputOne[1]}", inputOne[2], inputOne[3]); string[] inputTwo = Console.ReadLine().Split(); var tupleTwo = new Threeuple <string, int, bool>(inputTwo[0], int.Parse(inputTwo[1]), inputTwo[2] == "drunk"); string[] inputThree = Console.ReadLine().Split(); var tupleThree = new Threeuple <string, double, string>(inputThree[0], double.Parse(inputThree[1]), inputThree[2]); Console.WriteLine(tupleOne); Console.WriteLine(tupleTwo); Console.WriteLine(tupleThree); }
public static void Main() { string[] personInfo = Console.ReadLine() .Split(" "); string[] personBeerInfo = Console.ReadLine() .Split(" "); string[] bankInfo = Console.ReadLine() .Split(" "); string firstPersonName = $"{personInfo[0]} {personInfo[1]}"; string firstPersonAddress = personInfo[2]; string firstPersonTown = personInfo[3]; bool seconPersonIsDrunk = false; if (personBeerInfo[2] == "drunk") { seconPersonIsDrunk = true; } string secondePersonName = personBeerInfo[0]; double secondPersonLitersBeer = double.Parse(personBeerInfo[1]); string thirdPersonName = bankInfo[0]; decimal thirdPersonAccount = decimal.Parse(bankInfo[1]); string thirdPersonBankName = bankInfo[2]; var firstPersonThreeuple = new Threeuple <string, string, string>(firstPersonName, firstPersonAddress, firstPersonTown); var secondPersonThreeuple = new Threeuple <string, double, bool>(secondePersonName, secondPersonLitersBeer, seconPersonIsDrunk); var thirdPersonThreeuple = new Threeuple <string, decimal, string>(thirdPersonName, thirdPersonAccount, thirdPersonBankName); Console.WriteLine(firstPersonThreeuple); Console.WriteLine(secondPersonThreeuple); Console.WriteLine($"{thirdPersonThreeuple.Item1} -> {thirdPersonThreeuple.Item2:f1} -> {thirdPersonThreeuple.Item3}"); }
static void Main(string[] args) { string[] firstInput = Console.ReadLine().Split(); string first = firstInput[0] + " " + firstInput[1]; string adress = firstInput[2]; string town = string.Empty; for (int i = 3; i < firstInput.Length; i++) { town += firstInput[i] + " "; } Threeuple <string, string, string> firstthreeuple = new Threeuple <string, string, string>(first, adress, town); Console.WriteLine(firstthreeuple.ToString()); string[] secondInput = Console.ReadLine().Split(); string name = secondInput[0]; int litersBeer = int.Parse(secondInput[1]); string info = secondInput[2]; bool type = false; if (info == "drunk") { type = true; } Threeuple <string, int, bool> secondTuple = new Threeuple <string, int, bool>(name, litersBeer, type); Console.WriteLine(secondTuple.ToString()); string[] thirdInput = Console.ReadLine().Split(); string firstName = thirdInput[0]; double balance = double.Parse(thirdInput[1]); string bankName = thirdInput[2]; Threeuple <string, double, string> thirdTuple = new Threeuple <string, double, string>(firstName, balance, bankName); Console.WriteLine(thirdTuple.ToString()); }