Advertisement
didito33

SoftuniExam

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