Advertisement
TargeTPoweR

Untitled

Mar 22nd, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 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 currencyToChange;
  24. int currencyToRecieve;
  25. int currencyCount;
  26. string exit = "Для выхода введите 4.";
  27.  
  28. while (tryCount >= 0)
  29. {
  30. Console.WriteLine("Здравствуйте. Какую валюту в какую вы желаете обменять?");
  31. Console.WriteLine("1 - Доллар США.");
  32. Console.WriteLine("2 - Российский рубль.");
  33. Console.WriteLine("3 - Мексиканское пессо.");
  34. Console.WriteLine(exit);
  35. currencyToChange = Convert.ToInt32(Console.ReadLine());
  36. if (currencyToChange == 4)
  37. {
  38. break;
  39. }
  40. Console.WriteLine("В каком количестве?");
  41. Console.WriteLine(exit);
  42. currencyCount = Convert.ToInt32(Console.ReadLine());
  43. if (currencyCount == 4)
  44. {
  45. break;
  46. }
  47. Console.WriteLine("В какую валюту желаете перевести?");
  48. Console.WriteLine("1 - Доллар США.");
  49. Console.WriteLine("2 - Российский рубль.");
  50. Console.WriteLine("3 - Мексиканское пессо.");
  51. Console.WriteLine(exit);
  52. currencyToRecieve = Convert.ToInt32(Console.ReadLine());
  53.  
  54. if (currencyToRecieve == 4)
  55. {
  56. break;
  57. }
  58. else if (currencyToChange == 1 && currencyToRecieve == 2)
  59. {
  60. rub += currencyCount * usdRub;
  61. usd -= currencyCount;
  62. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  63. Console.WriteLine(exit);
  64. }
  65. else if (currencyToChange == 1 && currencyToRecieve == 3)
  66. {
  67. mxn += currencyCount * usdMxn;
  68. usd -= currencyCount;
  69. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  70. Console.WriteLine(exit);
  71. }
  72. else if (currencyToChange == 2 && currencyToRecieve == 1)
  73. {
  74. usd += currencyCount * rubUsd;
  75. rub -= currencyCount;
  76. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  77. Console.WriteLine(exit);
  78. }
  79. else if (currencyToChange == 2 && currencyToRecieve == 3)
  80. {
  81. mxn += currencyCount * rubMxn;
  82. rub -= currencyCount;
  83. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  84. Console.WriteLine(exit);
  85. }
  86. else if (currencyToChange == 3 && currencyToRecieve == 1)
  87. {
  88. usd += currencyCount * mxnUsd;
  89. mxn -= currencyCount;
  90. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  91. Console.WriteLine(exit);
  92. }
  93. else if (currencyToChange == 3 && currencyToRecieve == 2)
  94. {
  95. rub += currencyCount * mxnRub;
  96. mxn -= currencyCount;
  97. Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
  98. Console.WriteLine(exit);
  99. }
  100. }
  101. }
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement