Advertisement
Guest User

2.2

a guest
Aug 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Задача_2._2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. bool a = true;
  10. float dollar = 100f;
  11. float rubles = 10000f;
  12. float bel_rubles = 300f;
  13. float kolichestvo;
  14. float kolichestvo2;
  15. int choice1;
  16. while (a)
  17. {
  18. Console.WriteLine("У вас на счету " + dollar + " долларов и " + rubles + " рублей и " + bel_rubles + " белорусских рублей.");
  19. Console.WriteLine("Какую валюту хотите обменять?");
  20. Console.WriteLine("1. Доллары (1 доллар стоит 60 рублей и 2 бел. рубля.)");
  21. Console.WriteLine("2. Рубли (1 рубль стоит 1/60 рубля и 1/30 бел. рубля.)");
  22. Console.WriteLine("3. Белорусские Рубли (1 бел. рубль стоит 1/2 доллара и 30 рублей.)");
  23. Console.WriteLine("4. Закончить обмен");
  24. Console.Write("Выберите действие, введя цифру: ");
  25. choice1 = Convert.ToInt32(Console.ReadLine());
  26.  
  27. if (choice1 != 1 && choice1 != 2 && choice1 != 3 && choice1 != 4)
  28. {
  29. Console.WriteLine("Неверный ввод.");
  30. continue;
  31. }
  32. else if (choice1 == 4)
  33. {
  34. Console.WriteLine("Вы кончили.");
  35. Console.WriteLine("(Нажмите Enter, чтобы продолжить.)");
  36. Console.ReadLine();
  37. break;
  38. }
  39. else
  40. {
  41.  
  42.  
  43. Console.WriteLine("Сколько денег хотите перевести?");
  44. kolichestvo2 = Convert.ToInt32(Console.ReadLine());
  45. kolichestvo = kolichestvo2;
  46. if (choice1 == 1)
  47. {
  48. if (kolichestvo > dollar)
  49. {
  50. Console.WriteLine("Неверный ввод");
  51. continue;
  52. }
  53. if (kolichestvo <= dollar)
  54. {
  55.  
  56.  
  57. }
  58.  
  59. }
  60. if (choice1 == 2)
  61. {
  62. if (kolichestvo > rubles)
  63. {
  64. Console.WriteLine("Неверный ввод");
  65. }
  66. if (kolichestvo <= rubles)
  67. {
  68.  
  69. }
  70. }
  71. if (choice1 == 3)
  72. {
  73. if (kolichestvo > bel_rubles)
  74. {
  75. Console.WriteLine("Неверный ввод");
  76. }
  77. if (kolichestvo <= bel_rubles)
  78. {
  79.  
  80. }
  81. }
  82. Console.WriteLine("В какую валюту хотите перевести?");
  83. Console.WriteLine("1. Доллары");
  84. Console.WriteLine("2. Рубли");
  85. Console.WriteLine("3. Белорусские Рубли");
  86. Console.Write("Выберите действие, введя цифру: ");
  87. int choice2 = Convert.ToInt32(Console.ReadLine());
  88. if (choice2 != 1 && choice2 != 2 && choice2 != 3)
  89. {
  90. Console.WriteLine("Неверно.");
  91. continue;
  92. }
  93. else
  94. {
  95. if (choice1 == 1 && choice2 == 1)
  96. {
  97. Console.WriteLine("Нет смысла обменивать доллары в доллары");
  98. }
  99. else if (choice1 == 1 && choice2 == 2)
  100. {
  101. dollar = dollar - kolichestvo;
  102. rubles = rubles + kolichestvo * 60;
  103. }
  104. else if (choice1 == 1 && choice2 == 3)
  105. {
  106. dollar = dollar - kolichestvo;
  107. bel_rubles = bel_rubles + kolichestvo * 2;
  108. }
  109. else if (choice1 == 2 && choice2 == 1)
  110. {
  111. rubles = rubles - kolichestvo;
  112. dollar = dollar + kolichestvo / 60;
  113. }
  114. else if (choice1 == 2 && choice2 == 2)
  115. {
  116. Console.WriteLine("Нет смысла обменивать рубли в рубли");
  117. }
  118. else if (choice1 == 2 && choice2 == 3)
  119. {
  120. rubles = rubles - kolichestvo;
  121. bel_rubles = bel_rubles + kolichestvo / 30;
  122. }
  123. else if (choice1 == 3 && choice2 == 1)
  124. {
  125. bel_rubles = bel_rubles - kolichestvo;
  126. dollar = dollar + kolichestvo / 2;
  127. }
  128. else if (choice1 == 3 && choice2 == 2)
  129. {
  130. bel_rubles = kolichestvo;
  131. rubles = rubles + kolichestvo * 30;
  132. }
  133. else if (choice1 == 3 && choice2 == 3)
  134. {
  135. Console.WriteLine("Нет смысла обменивать бел. рубли в бел. рубли");
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement