public static void Main() { var inputLine = Console.ReadLine(); while (!inputLine.Equals("End")) { var tokens = inputLine.Split().Select(int.Parse).ToArray(); BeerCounter.BuyBeer(tokens[0]); BeerCounter.DrinkBeer(tokens[1]); inputLine = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beersDrankCount}"); }
static void Main(string[] args) { string line = Console.ReadLine(); while (line != "End") { int[] input = line.Split().Select(int.Parse).ToArray(); int bought = input[0]; int drank = input[1]; BeerCounter.BuyBeer(bought); BeerCounter.DrinkBeer(drank); line = Console.ReadLine(); } Console.WriteLine(BeerCounter.beerInStock + " " + BeerCounter.beersDrankCount); }
static void Main() { string input = Console.ReadLine(); while (!input.Equals("End")) { int[] p = input.Split(' ').Select(int.Parse).ToArray(); BeerCounter.BuyBeer(p[0]); BeerCounter.DrikBeer(p[1]); input = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beerDrank}"); }
static void Main(string[] args) { string input = Console.ReadLine(); while (input != "End") { string[] tokens = input.Split(); int bought = int.Parse(tokens[0]); int drank = int.Parse(tokens[1]); BeerCounter beer = new BeerCounter(bought, drank); BeerCounter.BuyBeer(bought); BeerCounter.DrinkBeer(drank); input = Console.ReadLine(); } Console.Write(BeerCounter.beerInStock + " "); Console.WriteLine(BeerCounter.beersDrankCount); }
public static void Main() { string input = Console.ReadLine(); while (input != "End") { int[] beers = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); int boughtBeers = beers[0]; int drankBeers = beers[1]; BeerCounter.ByeBeer(boughtBeers); BeerCounter.DrinkBeer(drankBeers); input = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.BeersInStock} {BeerCounter.BeersDrankCount}"); }
public static void Main() { while (true) { var drinkingCommand = Console.ReadLine(); if (drinkingCommand == "End") { break; } var beers = drinkingCommand .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToList(); BeerCounter.BuyBeer(beers[0]); BeerCounter.DrinkBeer(beers[1]); } Console.WriteLine($"{BeerCounter.BeerInStock} {BeerCounter.BeersDrankCount}"); }
static void Main(string[] args) { while (true) { string inputLine = Console.ReadLine(); if (inputLine == "End") { break; } List <int> inputParameters = inputLine.Split(' ').Select(int.Parse).ToList(); BeerCounter.BuyBeer(inputParameters[0]); BeerCounter.DrinkBeer(inputParameters[1]); } Console.Write(BeerCounter.BeerInStock + " "); Console.WriteLine(BeerCounter.BeersDrankCount); }
public static void Main() { string input = Console.ReadLine(); while (input != "End") { int[] bottleInfo = input .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); BeerCounter.BuyBeer(bottleInfo[0]); BeerCounter.DrinkBeer(bottleInfo[1]); input = Console.ReadLine(); } int[] beerResults = BeerCounter.GetBeerInfo(); Console.WriteLine($"{beerResults[0]} {beerResults[1]}"); }