static void Main(string[] args) { string[] command = Console.ReadLine().Split(); while (command[0] != "End") { BeerCounter.BuyBeer(int.Parse(command[0])); BeerCounter.DrinkBeer(int.Parse(command[1])); command = Console.ReadLine().Split(); } Console.WriteLine(BeerCounter.stock + " " + BeerCounter.drunkBeers); Console.ReadKey(); }
static void Main(string[] args) { string line = Console.ReadLine(); while (line != "End") { string[] input = line.Split(' '); int beerIn = int.Parse(input[0]); int beerOut = int.Parse(input[1]); var beeCounter = new BeerCounter(); beeCounter.AddBeer(beerIn); beeCounter.RemoveBeer(beerOut); line = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beerDrankCount}"); }
static void Main(string[] args) { string command = Console.ReadLine(); while (command != "End") { int[] input = command.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); BeerCounter.BuyBeer(input[0]); BeerCounter.DrinkBeer(input[1]); command = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beersDrankCount}"); }
static void Main(string[] args) { string command = Console.ReadLine(); int beersBought = 0; int beersDrunk = 0; while (command != "End") { string[] splits = command.Split(' '); beersBought = Int32.Parse(splits[0]); beersDrunk = Int32.Parse(splits[1]); BeerCounter.BuyBeer(beersBought); BeerCounter.DrinkBeer(beersDrunk); command = Console.ReadLine(); } Console.WriteLine("Beers remaining in Stock : {0}, Beers Drunk: {1}", BeerCounter.beerInStock, BeerCounter.beerDrankCount); }
static void Main(string[] args) { var input = Console.ReadLine(); while (!input.Equals("End")) { var beers = input .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); BeerCounter.BuyBeer(beers[0]); BeerCounter.DrinkBeer(beers[1]); input = Console.ReadLine(); } Console.WriteLine($"{BeerCounter.beerInStock} {BeerCounter.beerDrankCount}"); }