Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Tasks
- {
- class Program
- {
- static void Main(string[] args)
- {
- float usd = 1000f;
- float rub = 100000f;
- float mxn = 50000f;
- float usdRub = 80f;
- float usdMxn = 24.47f;
- float rubUsd = 0.013f;
- float rubMxn = 0.31f;
- float mxnUsd = 0.041f;
- float mxnRub = 3.28f;
- int tryCount = 0;
- int currencyChose1;
- int currencyChose2;
- int currencyCount;
- string exit = "Для выхода введите 4.";
- while (tryCount >= 0)
- {
- tryCount++;
- Console.WriteLine("Здравствуйте. Какую валюту в какую вы желаете обменять?");
- Console.WriteLine("1 - Доллар США.");
- Console.WriteLine("2 - Российский рубль.");
- Console.WriteLine("3 - Мексиканское пессо.");
- Console.WriteLine(exit);
- currencyChose1 = Convert.ToInt32(Console.ReadLine());
- if (currencyChose1 == 4)
- {
- break;
- }
- Console.WriteLine("В каком количестве?");
- Console.WriteLine(exit);
- currencyCount = Convert.ToInt32(Console.ReadLine());
- if (currencyCount == 4)
- {
- break;
- }
- Console.WriteLine("В какую валюту желаете перевести?");
- Console.WriteLine("1 - Доллар США.");
- Console.WriteLine("2 - Российский рубль.");
- Console.WriteLine("3 - Мексиканское пессо.");
- Console.WriteLine(exit);
- currencyChose2 = Convert.ToInt32(Console.ReadLine());
- if (currencyChose2 == 4)
- {
- break;
- }
- else if (currencyChose1 == 1 && currencyChose2 == 2)
- {
- rub += currencyCount * usdRub;
- usd -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- else if (currencyChose1 == 1 && currencyChose2 == 3)
- {
- mxn += currencyCount * usdMxn;
- usd -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- else if (currencyChose1 == 2 && currencyChose2 == 1)
- {
- usd += currencyCount * rubUsd;
- rub -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- else if (currencyChose1 == 2 && currencyChose2 == 3)
- {
- mxn += currencyCount * rubMxn;
- rub -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- else if (currencyChose1 == 3 && currencyChose2 == 1)
- {
- usd += currencyCount * mxnUsd;
- mxn -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- else if (currencyChose1 == 3 && currencyChose2 == 2)
- {
- rub += currencyCount * mxnRub;
- mxn -= currencyCount;
- Console.WriteLine($"Ваш баланс {usd} долларов, {rub} рублей и {mxn} пессо.");
- Console.WriteLine(exit);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement