Advertisement
Guest User

Untitled

a guest
Oct 25th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 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 batch = int.Parse(Console.ReadLine());
  10. bool flour = false;
  11. bool eggs = false;
  12. bool sugar = false;
  13. for (int i = 1; i <= batch; i++)
  14. {
  15. while (true)
  16. {
  17. string product = Console.ReadLine();
  18. if (product=="flour")
  19. {
  20. flour = true;
  21. }
  22. else if (product == "eggs")
  23. {
  24. eggs = true;
  25. }
  26. else if (product == "sugar")
  27. {
  28. sugar = true;
  29. }
  30. if (product == "Bake!")
  31. {
  32. if (flour && eggs && sugar)
  33. {
  34. Console.WriteLine($"Baking batch number {i}...");
  35. break;
  36. }
  37.  
  38. else
  39. {
  40. Console.WriteLine("The batter should contain flour, eggs and sugar!");
  41. }
  42. }
  43.  
  44. }
  45. flour = false;
  46. eggs = false;
  47. sugar = false;
  48. }
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement