Advertisement
angelneychev

08. Cookie factory

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