anizko

08. Cookie factory

Apr 17th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Cookie_factory
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int Partida = int.Parse(Console.ReadLine());
  10.  
  11.             for (int i = 1; i <= Partida; i++)
  12.             {
  13.                 int sugar = 0;
  14.                 int flour = 0;
  15.                 int eggs = 0;
  16.                
  17.                 while (!(flour > 0 && eggs > 0 && sugar > 0))
  18.                 {
  19.                 string Comand = Console.ReadLine();
  20.  
  21.                     while (Comand != "Bake!")
  22.                     {
  23.                         switch (Comand)
  24.                         {
  25.                             case "flour":
  26.                                 flour++;
  27.                                 break;
  28.                             case "eggs":
  29.                                 eggs++;
  30.                                 break;
  31.                             case "sugar":
  32.                                 sugar++;
  33.                                 break;
  34.                             default:
  35.                                 break;
  36.                         }
  37.                         Comand = Console.ReadLine();
  38.                     }
  39.                     if (!(flour > 0 && eggs > 0 && sugar > 0))
  40.                     {
  41.                         Console.WriteLine("The batter should contain flour, eggs and sugar!");
  42.                     }
  43.                 }
  44.                 Console.WriteLine($"Baking batch number {i}...");
  45.  
  46.             }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment