Advertisement
nikolayneykov

Untitled

Nov 3rd, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace draft
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             string input = string.Empty;
  11.             bool eggs = false;
  12.             bool flour = false;
  13.             bool sugar = false;
  14.  
  15.             for (int i = 1; i <= n; i++)
  16.             {
  17.                 while (true)
  18.                 {
  19.                     input = Console.ReadLine();
  20.                     if (input == "eggs")
  21.                     {
  22.                         eggs = true;
  23.                     }
  24.                     else if (input == "flour")
  25.                     {
  26.                         flour = true;
  27.                     }
  28.                     else if (input == "sugar")
  29.                     {
  30.                         sugar = true;
  31.                     }
  32.                     if (input == "Bake!")
  33.                     {
  34.                         if (eggs && flour && sugar)
  35.                         {
  36.                             Console.WriteLine($"Baking batch number {i}...");
  37.                             eggs = false;
  38.                             flour = false;
  39.                             sugar = false;
  40.                             break;
  41.                         }
  42.                         else
  43.                         {
  44.                             Console.WriteLine("The batter should contain flour, eggs and sugar!");
  45.                         }
  46.                     }
  47.                 }
  48.             }
  49.  
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement