Advertisement
simonakancheva

08. Cookie factory

Apr 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Softuni_part_four
  8. {
  9.  
  10.  
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             int count = int.Parse(Console.ReadLine());
  16.             for (int i = 1; i <=count; i++)
  17.             {
  18.                 string ingradient = Console.ReadLine();
  19.  
  20.                 bool eggs = false;
  21.                 bool flour = false;
  22.                 bool sugar = false;
  23.  
  24.                 while (true)
  25.                 {
  26.                     if (ingradient == "eggs")
  27.                     {
  28.                         eggs = true;
  29.                     }
  30.                     else if (ingradient == "flour")
  31.                     {
  32.                         flour = true;
  33.                     }
  34.                     else if (ingradient=="sugar")
  35.                     {
  36.                         sugar = true;
  37.                     }
  38.                     else if (ingradient=="Bake!")
  39.                     {
  40.                         if (eggs&&sugar&&flour==true)
  41.                         {
  42.                             Console.WriteLine($"Baking batch number {i}...");
  43.                             break;
  44.                         }
  45.                         else
  46.                         {
  47.                             Console.WriteLine("The batter should contain flour, eggs and sugar!");
  48.                            
  49.                         }
  50.                        
  51.  
  52.                     }
  53.  
  54.  
  55.  
  56.                     ingradient = Console.ReadLine();
  57.                 }
  58.             }
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement