static void Main(string[] args) { string[] personInfo = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries); string[] personDrunkStatus = Console.ReadLine() .Split(); string[] bankInfo = Console.ReadLine() .Split(); string fullName = personInfo[0] + " " + personInfo[1]; string address = personInfo[2]; string town = string.Join(" ", personInfo.Skip(3)); string nameOfDrinker = personDrunkStatus[0]; int litersBeer = int.Parse(personDrunkStatus[1]); bool isDrunk = personDrunkStatus[2] == "drunk" ? true : false; string nameOfBankCustomer = bankInfo[0]; double bankBalance = double.Parse(bankInfo[1]); string bankName = bankInfo[2]; MyThreeuple <string, string, string> personThreeuple = new MyThreeuple <string, string, string>(fullName, address, town); MyThreeuple <string, int, bool> drunkThreeuple = new MyThreeuple <string, int, bool>(nameOfDrinker, litersBeer, isDrunk); MyThreeuple <string, double, string> bankThreeuple = new MyThreeuple <string, double, string>(nameOfBankCustomer, bankBalance, bankName); Console.WriteLine(personThreeuple); Console.WriteLine(drunkThreeuple); Console.WriteLine(bankThreeuple); }
static void Main(string[] args) { string[] items = Console.ReadLine().Split(); string fullName = $"{items[0]} {items[1]}"; string address = items[2]; string town = $"{items[items.Length - 1]}"; if (items.Length > 4) { town = $"{items[items.Length - 2]} {items[items.Length - 1]}"; } MyThreeuple <string, string, string> myThreeuple = new MyThreeuple <string, string, string>(fullName, address, town); Console.WriteLine(myThreeuple); string[] secondItems = Console.ReadLine().Split(); bool drinking = false; if (secondItems[2] == "drunk") { drinking = true; } MyThreeuple <string, int, bool> secondThreeuple = new MyThreeuple <string, int, bool>(secondItems[0], int.Parse(secondItems[1]), drinking); Console.WriteLine(secondThreeuple); string[] thirdItems = Console.ReadLine().Split(); MyThreeuple <string, double, string> thirdThreeuple = new MyThreeuple <string, double, string>(thirdItems[0], double.Parse(thirdItems[1]), thirdItems[2]); Console.WriteLine(thirdThreeuple); }
public static void Main(string[] args) { var personInfo = Console.ReadLine() .Split(); var person = $"{personInfo[0]} {personInfo[1]}"; var addres = personInfo[2]; var town = string.Empty; ; if (personInfo.Length > 4) { town = $"{personInfo[3]} {personInfo[4]}"; } else { town = personInfo[3]; } var personBeerInfo = Console.ReadLine() .Split(); var name = personBeerInfo[0]; var litersOfbear = int.Parse(personBeerInfo[1]); var drunk = false; if (personBeerInfo[2] == "drunk") { drunk = true; } var personBankInfo = Console.ReadLine() .Split(); var userAccaunt = personBankInfo[0]; var accauntBalance = double.Parse(personBankInfo[1]); var bankName = personBankInfo[2]; var personAddres = new MyThreeuple <string, string, string>(person, addres, town); var personDrunkOrNot = new MyThreeuple <string, int, bool>(name, litersOfbear, drunk); var personBankAccount = new MyThreeuple <string, double, string>(userAccaunt, accauntBalance, bankName); Console.WriteLine(personAddres); Console.WriteLine(personDrunkOrNot); Console.WriteLine(personBankAccount); }
static void Main(string[] args) { string[] inputStringOne = Console.ReadLine().Split(); string name = inputStringOne[0] + " " + inputStringOne[1]; string street = inputStringOne[2]; List <string> town = new List <string>(); for (int i = 3; i < inputStringOne.Length; i++) { town.Add(inputStringOne[i]); } MyThreeuple <string, string, string> myThreeupleStrings = new MyThreeuple <string, string, string>(name, street, string.Join(" ", town)); Console.WriteLine(myThreeupleStrings); string[] inputStringTwo = Console.ReadLine().Split(); string nameTwo = inputStringTwo[0]; double beerLiters = int.Parse(inputStringTwo[1]); bool action = false; if (inputStringTwo[2] == "drunk") { action = true; } else if (inputStringTwo[2] == "not") { action = false; } MyThreeuple <string, double, bool> myThreeupleStringsTwo = new MyThreeuple <string, double, bool>(nameTwo, beerLiters, action); Console.WriteLine(myThreeupleStringsTwo); string[] inputStringThree = Console.ReadLine().Split(); string nameThree = inputStringThree[0]; double amount = double.Parse(inputStringThree[1]); string bankName = inputStringThree[2]; MyThreeuple <string, double, string> myThreeupleStringsThree = new MyThreeuple <string, double, string>(nameThree, amount, bankName); Console.WriteLine(myThreeupleStringsThree); }