Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 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 cookiefactory
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int counter = 0;
  15.             bool flour = false;
  16.             bool sugar = false;
  17.             bool eggs = false;
  18.             string comd = "";
  19.  
  20.             while (counter<n)
  21.             {              
  22.                 while (comd!="Bake!")
  23.                 {
  24.                     comd = Console.ReadLine();
  25.                     if (comd=="flour")
  26.                     {
  27.                         flour = true;
  28.                     }
  29.                     else if (comd=="sugar")
  30.                     {
  31.                         sugar = true;
  32.                     }
  33.                     else if ( comd=="eggs")
  34.                     {
  35.                         eggs = true;
  36.                     }
  37.                 }
  38.                if ( flour==false||sugar==false||eggs==false)
  39.                 {                  
  40.                     Console.WriteLine("The batter should contain flour, eggs and sugar!");
  41.                     comd = string.Empty;
  42.                 }
  43.                else
  44.                 {
  45.                     counter++;
  46.                     Console.WriteLine($"Baking batch number {counter}...");
  47.                 }
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement