static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var input1 = Console.ReadLine().Split().ToArray(); var fullName = input1[0] + " " + input1[1]; var address = input1[2]; var town = input1[3]; Threeuple <string, string, string> tuple1 = new Threeuple <string, string, string>(fullName, address, town); Console.WriteLine(tuple1.ToString()); var input2 = Console.ReadLine().Split().ToArray(); var name = input2[0]; var litterOfBeer = int.Parse(input2[1]); bool drunkOrNot = input2[2] == "drunk" ? true : false; Threeuple <string, int, bool> tuple2 = new Threeuple <string, int, bool>(name, litterOfBeer, drunkOrNot); Console.WriteLine(tuple2.ToString()); var input3 = Console.ReadLine().Split().ToArray(); Threeuple <string, double, string> tuple3 = new Threeuple <string, double, string>(input3[0], double.Parse(input3[1]), input3[2]); Console.WriteLine(tuple3.ToString()); }
public static void Main(string[] args) { var inputInfo = Console.ReadLine().Split(); var inputBeers = Console.ReadLine().Split(); var inputBank = Console.ReadLine().Split(); string fullName = inputInfo[0] + " " + inputInfo[1]; string adress = inputInfo[2]; string cityFullName = string.Join(" ", inputInfo.Skip(3)); string name = inputBeers[0]; int litters = int.Parse(inputBeers[1]); string drinkOrNot = inputBeers[2]; if (drinkOrNot == "drunk") { drinkOrNot = "True"; } else { drinkOrNot = "False"; } string nameBank = inputBank[0]; double accountBalance = double.Parse(inputBank[1]); string bankName = inputBank[2]; var firstInfo = new Threeuple <string, string, string>(fullName, adress, cityFullName); var secondInfo = new Threeuple <string, int, string>(name, litters, drinkOrNot); var thirdInfo = new Threeuple <string, double, string>(nameBank, accountBalance, bankName); Console.WriteLine(firstInfo.ToString()); Console.WriteLine(secondInfo.ToString()); Console.WriteLine(thirdInfo.ToString()); }
public static void Main() { var args = Console.ReadLine().Split(); var names = $"{args[0]} {args[1]}"; var address = args[2]; var town = args[3]; var namesAddress = new Threeuple <string, string, string>(names, address, town); args = Console.ReadLine().Split(' '); var name = args[0]; int liters = int.Parse(args[1]); bool isDrunk; if (args[2] == "drunk") { isDrunk = true; } else { isDrunk = false; } var nameLiters = new Threeuple <string, int, bool>(name, liters, isDrunk); args = Console.ReadLine().Split(' '); string userName = args[0]; double balance = double.Parse(args[1]); string bank = args[2]; var money = new Threeuple <string, double, string>(userName, balance, bank); Console.WriteLine(namesAddress.ToString()); Console.WriteLine(nameLiters.ToString()); Console.WriteLine(money.ToString()); }
static void Main(string[] args) { string[] personAdress = Console.ReadLine().Split(); string name = $"{personAdress[0]} {personAdress[1]}"; string addres = personAdress[2]; List <string> towns = personAdress.Skip(3).ToList(); string town = string.Join(" ", towns); Threeuple <string, string, string> NameTuple = new Threeuple <string, string, string>(name, addres, town); string[] person = Console.ReadLine().Split(); name = person[0]; int age = int.Parse(person[1]); bool isDrung = person[2] == "drunk" ? true : false; Threeuple <string, int, bool> personTuple = new Threeuple <string, int, bool>(name, age, isDrung); string[] nums = Console.ReadLine().Split(); string intNum = nums[0]; double doubleNum = double.Parse(nums[1]); string bank = nums[2]; Threeuple <string, double, string> numsTuple = new Threeuple <string, double, string>(intNum, doubleNum, bank); Console.WriteLine(NameTuple); Console.WriteLine(personTuple); Console.WriteLine(numsTuple); }
public static void Main(string[] args) { string[] data = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = data[0] + " " + data[1]; string address = data[2]; string town = string.Empty; for (int i = 3; i < data.Length; i++) { town += data[i] + " "; } town = town.Trim(); var threeuple1 = new Threeuple <string, string, string>(name, address, town); data = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); name = data[0]; int liters = int.Parse(data[1]); bool isDrunk = data[2] == "drunk" ? true : false; var threeuple2 = new Threeuple <string, int, bool>(name, liters, isDrunk); data = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); name = data[0]; double balance = double.Parse(data[1]); string bank = data[2]; var threeuple3 = new Threeuple <string, double, string>(name, balance, bank); Console.WriteLine(threeuple1.ToString()); Console.WriteLine(threeuple2.ToString()); Console.WriteLine(threeuple3.ToString()); }
public static void Main() { // {first name} {last name} {address} {town} string[] line1Args = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); string town = string.Join(' ', line1Args.Skip(3)); var tuple = new Threeuple<string, string, string>($"{line1Args[0]} {line1Args[1]}", line1Args[2], town); Console.WriteLine(tuple); // {name} {liters of beer} {drunk or not} string[] line2Args = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); string name = string.Join(' ', line2Args.SkipLast(2)); int liters = int.Parse(line2Args[line2Args.Length - 2]); bool isDrunk = line2Args[line2Args.Length - 1] == "drunk" ? true : false; var otherTuple = new Threeuple<string, int, bool>(name, liters, isDrunk); Console.WriteLine(otherTuple); // {name} {account balance} {bank name} string[] line3Args = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); name = string.Join(' ', line3Args.SkipLast(2)); double balance = double.Parse(line3Args[line3Args.Length - 2]); string bank = line3Args.Last(); var anotherTuple = new Threeuple<string, double, string>(name, balance, bank); Console.WriteLine(anotherTuple); }
public static void Main() { var firstArgs = Console.ReadLine().Split(' '); var secondArgs = Console.ReadLine().Split(' '); var thirdArgs = Console.ReadLine().Split(' '); firstArgs = new string[3] { firstArgs[0] + ' ' + firstArgs[1], firstArgs[2], firstArgs[3] }; var firstTuple = new Threeuple <string, string, string> (firstArgs[0], firstArgs[1], firstArgs[2]); var secondTuple = new Threeuple <string, int, bool> (secondArgs[0], int.Parse(secondArgs[1]), secondArgs[2].Equals("drunk") ? true : false); var thirdTuple = new Threeuple <string, double, string> (thirdArgs[0], double.Parse(thirdArgs[1]), thirdArgs[2]); Console.WriteLine(firstTuple.ToString()); Console.WriteLine(secondTuple.ToString()); Console.WriteLine(thirdTuple.ToString()); }
static void Main(string[] args) { string[] personInfo = Console.ReadLine().Split(); string personName = personInfo[0] + " " + personInfo[1]; string adress = personInfo[2]; string town = personInfo[3]; string[] beerInfo = Console.ReadLine().Split(); string beerName = beerInfo[0]; int amountOfBeer = int.Parse(beerInfo[1]); bool conditon = beerInfo[2] == "drunk" ? true : false; string[] bankInfo = Console.ReadLine().Split(); string name = bankInfo[0]; double balance = double.Parse(bankInfo[1]); string bankName = bankInfo[2]; var threeuplePerson = new Threeuple <string, string, string>(personName, adress, town); var threeupleBeer = new Threeuple <string, int, bool>(beerName, amountOfBeer, conditon); var threeupleBank = new Threeuple <string, double, string>(name, balance, bankName); Console.WriteLine(threeuplePerson); Console.WriteLine(threeupleBeer); Console.WriteLine(threeupleBank); }
static void Main(string[] args) { var personInfo = Console.ReadLine().Split(); var name = personInfo[0] + " " + personInfo[1]; var address = personInfo[2]; var town = string.Empty; if (personInfo.Length > 4) { town = personInfo[3] + " " + personInfo[4]; } else { town = personInfo[3]; } var beerInfo = Console.ReadLine().Split(); var name2 = beerInfo[0]; var liters = int.Parse(beerInfo[1]); var drunk = beerInfo[2] == "drunk" ? true : false; var bankInfo = Console.ReadLine().Split(); var personName = bankInfo[0]; var balance = double.Parse(bankInfo[1]); var bankName = bankInfo[2]; Threeuple <string, string, string> infoPerson = new Threeuple <string, string, string>(name, address, town); Threeuple <string, int, bool> infoBeer = new Threeuple <string, int, bool>(name2, liters, drunk); Threeuple <string, double, string> infoBank = new Threeuple <string, double, string>(personName, balance, bankName); Console.WriteLine(infoPerson.GetInfo()); Console.WriteLine(infoBeer.GetInfo()); Console.WriteLine(infoBank.GetInfo()); }
public static void Main(string[] args) { string[] personInfo = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); string firstName = personInfo[0]; string lastName = personInfo[1]; string fullName = firstName + " " + lastName; string address = personInfo[2]; var town = personInfo.Skip(3); Threeuple <string, string, string> personInformation = new Threeuple <string, string, string>(fullName, address, string.Join(' ', town)); string[] personsBeerLitters = Console.ReadLine().Split(' '); string name = personsBeerLitters[0]; int littersBeer = int.Parse(personsBeerLitters[1]); string isDrunk = personsBeerLitters[2] == "drunk" ? "True" : "False"; Threeuple <string, int, string> personBeer = new Threeuple <string, int, string>(name, littersBeer, isDrunk); string[] personBankAccountInfo = Console.ReadLine().Split(' '); string nameOfPerson = personBankAccountInfo[0]; double accountBalance = double.Parse(personBankAccountInfo[1]); string bankName = personBankAccountInfo[2]; Threeuple <string, double, string> personBankInfo = new Threeuple <string, double, string>(nameOfPerson, accountBalance, bankName); Console.WriteLine(personInformation.ToString()); Console.WriteLine(personBeer.ToString()); Console.WriteLine(personBankInfo.ToString()); }
static void Main(string[] args) { string[] input1 = Console.ReadLine().Split(); string name = input1[0] + " " + input1[1]; string address = input1[2]; string town = input1[3]; var first = new Threeuple <string, string, string>(name, address, town); Console.WriteLine(first); string[] input2 = Console.ReadLine().Split(); string nameBeer = input2[0]; int litresBeer = int.Parse(input2[1]); bool drunkOrNot = input2[2] == "drunk" ? true : false; var second = new Threeuple <string, int, bool>(nameBeer, litresBeer, drunkOrNot); Console.WriteLine(second); string[] input3 = Console.ReadLine().Split(); string nameBank = input3[0]; double bankBalance = double.Parse(input3[1]); string bankName = input3[2]; var third = new Threeuple <string, double, string>(nameBank, bankBalance, bankName); Console.WriteLine(third); }
static void Main(string[] args) { string[] firstLine = Console.ReadLine().Split(); string fullName = $"{firstLine[0]} {firstLine[1]}"; string address = firstLine[2]; string town = string.Join(' ', firstLine.Skip(3)); Threeuple <string, string, string> firstThreeuple = new Threeuple <string, string, string>(fullName, address, town); Console.WriteLine(firstThreeuple); string[] secondLine = Console.ReadLine().Split(); string nameSecondLine = secondLine[0]; int amountOfBeer = int.Parse(secondLine[1]); bool isDrunk = secondLine[2] == "drunk" ? true : false; Threeuple <string, int, bool> secondLineThreeuple = new Threeuple <string, int, bool>(nameSecondLine, amountOfBeer, isDrunk); Console.WriteLine(secondLineThreeuple); string[] thirdLine = Console.ReadLine().Split(); string nameThirdLine = thirdLine[0]; double accountBalance = double.Parse(thirdLine[1]); string bankName = string.Join(' ', thirdLine.Skip(2)); Threeuple <string, double, string> thirdLineThreeuple = new Threeuple <string, double, string>(nameThirdLine, accountBalance, bankName); Console.WriteLine(thirdLineThreeuple); }
public static void Main() { var personInfo = Console.ReadLine().Split(); string fullName = personInfo[0] + " " + personInfo[1]; string address = personInfo[2]; string town = string.Join(" ", personInfo.Skip(3)); var nameAndBeer = Console.ReadLine().Split(); string name = nameAndBeer[0]; int beer = int.Parse(nameAndBeer[1]); string type = nameAndBeer[2]; bool isDrunk = type == "drunk" ? true : false; var bankBalance = Console.ReadLine().Split(); string personName = bankBalance[0]; double account = double.Parse(bankBalance[1]); string bank = bankBalance[2]; var firstTuple = new Threeuple <string, string, string>(fullName, address, town); var secondTuple = new Threeuple <string, int, bool>(name, beer, isDrunk); var thirdTuple = new Threeuple <string, double, string>(personName, account, bank); Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
static void Main(string[] args) { string[] firstLine = Console.ReadLine().Split().ToArray(); string fullName = firstLine[0] + " " + firstLine[1]; string city = string.Join(" ", firstLine.Skip(3)); Threeuple <string, string, string> firstThreeuple = new Threeuple <string, string, string>(fullName, firstLine[2], city); string[] secondLine = Console.ReadLine().Split().ToArray(); bool isDrunk = secondLine[2] == "drunk"; Threeuple <string, int, bool> seconThreeuple = new Threeuple <string, int, bool>(secondLine[0], int.Parse(secondLine[1]), isDrunk); string[] thirdLine = Console.ReadLine().Split().ToArray(); Threeuple <string, double, string> thirdThreeuple = new Threeuple <string, double, string>(thirdLine[0], double.Parse(thirdLine[1]), thirdLine[2]); Console.WriteLine($"{firstThreeuple.Item1} -> {firstThreeuple.Item2} -> {firstThreeuple.Item3}"); Console.WriteLine($"{seconThreeuple.Item1} -> {seconThreeuple.Item2} -> {seconThreeuple.Item3}"); Console.WriteLine($"{thirdThreeuple.Item1} -> {thirdThreeuple.Item2} -> {thirdThreeuple.Item3}"); }
static void Main(string[] args) { string[] nameAddress = Console.ReadLine().Split(); string name = nameAddress[0] + " " + nameAddress[1]; string street = nameAddress[2]; StringBuilder city = new StringBuilder(); for (int i = 3; i < nameAddress.Length; i++) { city.Append(nameAddress[i] + " "); } Threeuple <string, string, string> nameAdr = new Threeuple <string, string, string>(name, street, city.ToString()); string[] nameLitres = Console.ReadLine().Split(); bool isDrunk = false; if (nameLitres[2] == "drunk") { isDrunk = true; } Threeuple <string, int, bool> consumedBeer = new Threeuple <string, int, bool>(nameLitres[0], int.Parse(nameLitres[1]), isDrunk); string[] bankAccount = Console.ReadLine().Split(); Threeuple <string, double, string> nameBank = new Threeuple <string, double, string>(bankAccount[0], double.Parse(bankAccount[1]), bankAccount[2]); Console.WriteLine(nameAdr); Console.WriteLine(consumedBeer); Console.WriteLine(nameBank); }
public static void Main() { string[] firstLine = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string names = $"{firstLine[0]} {firstLine[1]}"; string address = firstLine[2]; string town = firstLine[3]; var threeuple1 = new Threeuple <string, string, string>(names, address, town); string[] secondLine = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = secondLine[0]; double beerAmount = double.Parse(secondLine[1]); bool IsDrunk = secondLine[2].ToLower() == "drunk"; var threeuple2 = new Threeuple <string, double, bool>(name, beerAmount, IsDrunk); string[] thirdLine = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name2 = thirdLine[0]; double accountBalance = double.Parse(thirdLine[1]); string bankName = thirdLine[2]; var threeuple3 = new Threeuple <string, double, string>(name2, accountBalance, bankName); Console.WriteLine(threeuple1); Console.WriteLine(threeuple2); Console.WriteLine(threeuple3); }
public static void Main() { string[] firstInputInfo = Console.ReadLine() .Split() .ToArray(); string fullName = $"{firstInputInfo[0]} {firstInputInfo[1]}"; string address = firstInputInfo[2]; string town = firstInputInfo.Length == 5 ? $"{firstInputInfo[3]} {firstInputInfo[4]}" : firstInputInfo[3]; string[] secondInputInfo = Console.ReadLine() .Split() .ToArray(); string name = secondInputInfo[0]; int amountOfBeer = int.Parse(secondInputInfo[1]); bool isDrunk = secondInputInfo[2] == "drunk" ? true : false; string[] thirdInputInfo = Console.ReadLine() .Split() .ToArray(); string inputName = thirdInputInfo[0]; double doubleNumber = double.Parse(thirdInputInfo[1]); string bankName = thirdInputInfo[2]; Threeuple <string, string, string> firstTuple = new Threeuple <string, string, string>(fullName, address, town); Threeuple <string, int, bool> secondTuple = new Threeuple <string, int, bool>(name, amountOfBeer, isDrunk); Threeuple <string, double, string> thirdTuple = new Threeuple <string, double, string>(inputName, doubleNumber, bankName); Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
static void Main(string[] args) { var personInfo = Console.ReadLine().Split(); var personName = personInfo[0] + " " + personInfo[1]; var address = personInfo[2]; var town = personInfo[3]; var beerInfo = Console.ReadLine().Split(); var beerName = beerInfo[0]; var amountOfBeer = int.Parse(beerInfo[1]); var condition = beerInfo[2] == "drunk" ? true : false; var bankInfo = Console.ReadLine().Split(); var name = bankInfo[0]; var balance = double.Parse(bankInfo[1]); var bankName = bankInfo[2]; var threeuplePerson = new Threeuple <string, string, string>(personName, address, town); var threeupleBeer = new Threeuple <string, int, bool>(beerName, amountOfBeer, condition); var threeupleBank = new Threeuple <string, double, string>(name, balance, bankName); Console.WriteLine(threeuplePerson.ToString()); Console.WriteLine(threeupleBeer.ToString()); Console.WriteLine(threeupleBank.ToString()); }
static void Main(string[] args) { int a = 5; int b = 2; double x = a / (double)b; bool isBigger = 5 > 10; Console.WriteLine(isBigger); string[] data = Console.ReadLine().Split(); string name = $"{data[0]} {data[1]}"; string address = data[2]; string town = data[3]; Threeuple <string, string, string> nameAddress = new Threeuple <string, string, string>(name, address, town); Console.WriteLine(nameAddress.ToString()); data = Console.ReadLine().Split(); name = data[0]; int beer = int.Parse(data[1]); bool isDrunk = data[2] == "drunk" ? true : false; Threeuple <string, int, bool> nameLiters = new Threeuple <string, int, bool>(name, beer, isDrunk); Console.WriteLine(nameLiters.ToString()); data = Console.ReadLine().Split(); string itemOne = data[0]; double itemTwo = double.Parse(data[1]); string itemThree = data[2]; Threeuple <string, double, string> intDouble = new Threeuple <string, double, string>(itemOne, itemTwo, itemThree); Console.WriteLine(intDouble.ToString()); }
private static Threeuple <string, string, string> ReturnsNameAccountBalanceBankName(string[] userInput) { var firstName = userInput[0]; var accountBalance = Decimal.Parse(userInput[1]).ToString("F1"); var bankName = userInput[2]; var firstNameAccountBalanceBankName = new Threeuple <string, string, string>(firstName, accountBalance, bankName); return(firstNameAccountBalanceBankName); }
private static Threeuple <string, string, string> ReturnsFullnameAddressTown(string[] userInput) { var fullname = userInput[0] + " " + userInput[1]; var address = userInput[2]; var town = userInput.Count() > 4 ? userInput[3] + " " + userInput[4] : userInput[3]; var nameAddressTown = new Threeuple <string, string, string>(fullname, address, town); return(nameAddressTown); }
private static Threeuple <string, int, string> ReturnsFirstNameLittersBeerDrunkOrNot(string[] userInput) { var firstName = userInput[0]; var beerLitters = int.Parse(userInput[1]); var drunkOrNot = userInput[2].ToLower() == "drunk" ? true : false; var firstNameBeerLittersDrunkOrNot = new Threeuple <string, int, string>(firstName, beerLitters, drunkOrNot.ToString()); return(firstNameBeerLittersDrunkOrNot); }
public static void Main() { var firstLine = Console.ReadLine().Split(' '); var secondLine = Console.ReadLine().Split(' '); var thirdLine = Console.ReadLine().Split(' '); var firstTuple = new Threeuple <string, string, string>(firstLine[0] + " " + firstLine[1], firstLine[2], firstLine[3]); var secondTuple = new Threeuple <string, int, bool>(secondLine[0], int.Parse(secondLine[1]), secondLine[2] == "drunk"); var thirdTuple = new Threeuple <string, double, string>(thirdLine[0], double.Parse(thirdLine[1]), thirdLine[2]); Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
static void Main(string[] args) { string[] input = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .ToArray(); string firstNameLastName = $"{input[0]} {input[1]}"; string address = input[2]; string town = string.Empty; for (int i = 3; i < input.Length; i++) { town += $" {input[i]}"; } Threeuple <string, string, string> myTuple = new Threeuple <string, string, string>(firstNameLastName, address, town); Console.WriteLine(myTuple); input = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .ToArray(); string name = input[0]; int litersOFBeer = int.Parse(input[1]); bool drunkOrNot = false; if (input[2] == "drunk") { drunkOrNot = true; } Threeuple <string, int, bool> mySecondTuple = new Threeuple <string, int, bool>(name, litersOFBeer, drunkOrNot); Console.WriteLine(mySecondTuple); input = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .ToArray(); name = input[0]; double accountBalance = double.Parse(input[1]); string bankName = input[2]; Threeuple <string, double, string> myThirdTuple = new Threeuple <string, double, string>(name, accountBalance, bankName); Console.WriteLine(myThirdTuple); }
static void Main(string[] args) { string[] firstInput = Console.ReadLine() .Split(); string personName = firstInput[0] + " " + firstInput[1]; string addres = firstInput[2]; string town = ""; if (firstInput.Length == 4) { town = firstInput[3]; } if (firstInput.Length == 5) { town = firstInput[3] + " " + firstInput[4]; } Threeuple <string, string, string> personInformation = new Threeuple <string, string, string>(personName, addres, town); string[] secondInput = Console.ReadLine() .Split(); string name = secondInput[0]; string litersOfBeer = secondInput[1]; string drunkOrNot = secondInput[2]; bool IsDrink = true; if (drunkOrNot == "drunk") { IsDrink = true; } else if (drunkOrNot == "not") { IsDrink = false; } Threeuple <string, string, bool> personDrinkInformation = new Threeuple <string, string, bool>(name, litersOfBeer, IsDrink); string[] thirdInput = Console.ReadLine() .Split(); string clientName = thirdInput[0]; double accountBallance = double.Parse(thirdInput[1]); string bankName = thirdInput[2]; Threeuple <string, double, string> personBankInformation = new Threeuple <string, double, string>(clientName, accountBallance, bankName); Console.WriteLine(personInformation); Console.WriteLine(personDrinkInformation); Console.WriteLine(personBankInformation); }
static void Main(string[] args) { string[] firstInput = Console.ReadLine().Split(); string name = $"{firstInput[0]} {firstInput[1]}"; string address = firstInput[2]; string town = string.Empty; if (firstInput.Length == 4) { town = firstInput[3]; } else if (firstInput.Length == 5) { town = $"{firstInput[3]} {firstInput[4]}"; } Threeuple <string, string, string> firstThreeuple = new Threeuple <string, string, string>(name, address, town); string[] secondInput = Console.ReadLine().Split(); name = secondInput[0]; int litersOfBeer = int.Parse(secondInput[1]); bool drunkOrNot = secondInput[2] == "drunk" ? true : false; Threeuple <string, int, bool> secondThreeuple = new Threeuple <string, int, bool>(name, litersOfBeer, drunkOrNot); string[] thirdInput = Console.ReadLine().Split(); name = thirdInput[0]; double accountBallance = double.Parse(thirdInput[1]); string bankName = thirdInput[2]; Threeuple <string, double, string> thirdThreeuple = new Threeuple <string, double, string>(name, accountBallance, bankName); Console.WriteLine(firstThreeuple); Console.WriteLine(secondThreeuple); Console.WriteLine(thirdThreeuple); }
public static void Main(string[] args) { string[] firstElements = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string names = firstElements[0] + " " + firstElements[1]; string address = firstElements[2]; string town = firstElements[3]; if (firstElements.Length > 4) { town += " " + firstElements[4]; } Threeuple firstThreeuple = new Threeuple(names, address, town); string[] secondElements = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = secondElements[0]; int beerLitres = int.Parse(secondElements[1]); string drunkOrNot = secondElements[2]; Threeuple secondThreeuple = new Threeuple(name, beerLitres, drunkOrNot); string[] thirdElements = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string username = thirdElements[0]; double bankBalance = double.Parse(thirdElements[1]); string bankName = thirdElements[2]; Threeuple thirdThreeuple = new Threeuple(username, bankBalance, bankName); bool boolean = false; if (secondThreeuple.DrunkOrNot == "drunk") { boolean = true; } Console.WriteLine($"{firstThreeuple.Name} -> {firstThreeuple.Address} -> {firstThreeuple.Town}"); Console.WriteLine($"{secondThreeuple.Name} -> {secondThreeuple.BeerLitres} -> {boolean}"); Console.WriteLine($"{thirdThreeuple.Name} -> {thirdThreeuple.BankBalance} -> {thirdThreeuple.BankName}"); }
public static void Main(string[] args) { string[] personInfo = Console.ReadLine().Split(); string name = personInfo[0] + " " + personInfo[1]; string address = personInfo[2]; string town = string.Empty; if (personInfo.Length > 4) { town = personInfo[3] + " " + personInfo[4]; } else { town = personInfo[3]; } var person = new Threeuple <string, string, string>(name, address, town); string[] beerInfo = Console.ReadLine().Split(); string nameDrinkingBeer = beerInfo[0]; int litersOfBeer = int.Parse(beerInfo[1]); string drunkOrNot = beerInfo[2]; bool isDrung = false; if (drunkOrNot == "drunk") { isDrung = true; } var beer = new Threeuple <string, int, bool>(nameDrinkingBeer, litersOfBeer, isDrung); string[] bankInfo = Console.ReadLine().Split(); //{ name} //{ account balance} //{ bank name} string nameForBankInfo = bankInfo[0]; double accBalance = double.Parse(bankInfo[1]); string bankName = bankInfo[2]; var bank = new Threeuple <string, double, string>(nameForBankInfo, accBalance, bankName); Console.WriteLine(person.GetInfo()); Console.WriteLine(beer.GetInfo()); Console.WriteLine(bank.GetInfo()); }
static void Main() { string[] input = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray(); Threeuple <string, string, string> threeuple = new Threeuple <string, string, string>($"{input[0]} {input[1]}", input[2], string.Join(" ", input.TakeLast(input.Length - 3))); Console.WriteLine($"{threeuple.FirstEntry} -> {threeuple.SecondEntry} -> {threeuple.ThirdEntry}"); input = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray(); Threeuple <string, int, bool> threeupleTwo = new Threeuple <string, int, bool>(input[0], int.Parse(input[1]), input[2] == "drunk"); Console.WriteLine($"{threeupleTwo.FirstEntry} -> {threeupleTwo.SecondEntry} -> {threeupleTwo.ThirdEntry}"); input = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray(); Threeuple <string, double, string> threeupleThree = new Threeuple <string, double, string>(input[0], double.Parse(input[1]), input[2]); Console.WriteLine($"{threeupleThree.FirstEntry} -> {threeupleThree.SecondEntry} -> {threeupleThree.ThirdEntry}"); }
static void Main(string[] args) { string[] firstLine = Console.ReadLine().Split(); Threeuple <string, string, string> threeupleOne = new Threeuple <string, string, string>(firstLine[0] + ' ' + firstLine[1], firstLine[2], string.Join(' ', firstLine.TakeLast(firstLine.Length - 3))); Console.WriteLine($"{threeupleOne.FirstItem} -> {threeupleOne.SecondItem} -> {threeupleOne.ThirdItem}"); string[] secondLine = Console.ReadLine().Split(); Threeuple <string, int, bool> threeupleTwo = new Threeuple <string, int, bool>(secondLine[0], int.Parse(secondLine[1]), secondLine[2] == "drunk"); Console.WriteLine($"{threeupleTwo.FirstItem} -> {threeupleTwo.SecondItem} -> {threeupleTwo.ThirdItem}"); string[] thirdLine = Console.ReadLine().Split(); Threeuple <string, double, string> threeupleThree = new Threeuple <string, double, string>(thirdLine[0], double.Parse(thirdLine[1]), thirdLine[2]); Console.WriteLine($"{threeupleThree.FirstItem} -> {threeupleThree.SecondItem} -> {threeupleThree.ThirdItem}"); }