Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _08._Cookie_factory
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfBatch = int.Parse(Console.ReadLine());
- int counterOfBatch = 0;
- int floorCounter = 0;
- int sugarCounter = 0;
- int eggCounter = 0;
- while (counterOfBatch < numberOfBatch)
- {
- string name = Console.ReadLine();
- while (name != "Bake!")
- {
- if (name == "flour")
- {
- floorCounter++;
- }
- else if (name == "sugar")
- {
- sugarCounter++;
- }
- else if (name == "eggs")
- {
- eggCounter++;
- }
- name = Console.ReadLine();
- }
- if (name == "Bake!")
- {
- if (eggCounter != 1 || sugarCounter != 1 || floorCounter != 1)
- {
- Console.WriteLine($"The batter should contain flour, eggs and sugar!");
- }
- else if (eggCounter == 1 && sugarCounter == 1 && floorCounter == 1)
- {
- counterOfBatch++;
- Console.WriteLine($"Baking batch number {counterOfBatch}...");
- floorCounter = 0;
- sugarCounter = 0;
- eggCounter = 0;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment