Advertisement
TargeTPoweR

Untitled

Mar 20th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Tasks
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. float usd = 1000f;
  14. float rub = 100000f;
  15. float mxn = 50000f;
  16. float usdRub = 80f;
  17. float usdMxn = 24.47f;
  18. float rubUsd = 0.013f;
  19. float rubMxn = 0.31f;
  20. float mxnUsd = 0.041f;
  21. float mxnRub = 3.28f;
  22. int tryCount = 0;
  23. int currencyChose1;
  24. int currencyChose2;
  25. int currencyCount;
  26. string exit = "Для выхода введите 4.";
  27.  
  28. while (tryCount >= 0)
  29. {
  30. tryCount++;
  31.  
  32. Console.WriteLine("Здравствуйте. Какую валюту в какую вы желаете обменять?");
  33. Console.WriteLine("1 - Доллар США.");
  34. Console.WriteLine("2 - Российский рубль.");
  35. Console.WriteLine("3 - Мексиканское пессо.");
  36. Console.WriteLine(exit);
  37. currencyChose1 = Convert.ToInt32(Console.ReadLine());
  38. if (currencyChose1 == 4)
  39. {
  40. break;
  41. }
  42. Console.WriteLine("В каком количестве?");
  43. Console.WriteLine(exit);
  44. currencyCount = Convert.ToInt32(Console.ReadLine());
  45. if (currencyCount == 4)
  46. {
  47. break;
  48. }
  49. Console.WriteLine("В какую валюту желаете перевести?");
  50. Console.WriteLine("1 - Доллар США.");
  51. Console.WriteLine("2 - Российский рубль.");
  52. Console.WriteLine("3 - Мексиканское пессо.");
  53. Console.WriteLine(exit);
  54. currencyChose2 = Convert.ToInt32(Console.ReadLine());
  55.  
  56. if (currencyChose2 == 4)
  57. {
  58. break;
  59. }
  60. else if (currencyChose1 == 1 && currencyChose2 == 2)
  61. {
  62. rub += currencyCount * usdRub;
  63. usd -= currencyCount;
  64. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  65. Console.WriteLine(exit);
  66. }
  67. else if (currencyChose1 == 1 && currencyChose2 == 3)
  68. {
  69. mxn += currencyCount * usdMxn;
  70. usd -= currencyCount;
  71. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  72. Console.WriteLine(exit);
  73. }
  74. else if (currencyChose1 == 2 && currencyChose2 == 1)
  75. {
  76. usd += currencyCount * rubUsd;
  77. rub -= currencyCount;
  78. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  79. Console.WriteLine(exit);
  80. }
  81. else if (currencyChose1 == 2 && currencyChose2 == 3)
  82. {
  83. mxn += currencyCount * rubMxn;
  84. rub -= currencyCount;
  85. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  86. Console.WriteLine(exit);
  87. }
  88. else if (currencyChose1 == 3 && currencyChose2 == 1)
  89. {
  90. usd += currencyCount * mxnUsd;
  91. mxn -= currencyCount;
  92. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  93. Console.WriteLine(exit);
  94. }
  95. else if (currencyChose1 == 3 && currencyChose2 == 2)
  96. {
  97. rub += currencyCount * mxnRub;
  98. mxn -= currencyCount;
  99. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  100. Console.WriteLine(exit);
  101. }
  102. }
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement