Lyubohd

Untitled

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