Advertisement
dydimitrov

Bakery

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