Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- namespace ConsoleApp25
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const string CommandExit = "7";
- const string CommandYuanToRuble = "1";
- const string CommandYuanToDollar = "2";
- const string CommandDollarToRuble = "3";
- const string CommandDollarToYuan = "4";
- const string CommandRubleToDollar = "5";
- const string CommandRubleToYuan = "6";
- int temporaryCurrency;
- float ruble = 500;
- float dollar = 500;
- float yuan = 500;
- float yuanToRuble = 0.25f;
- float yuanToDollar = 0.5f;
- float dollarToRuble = 0.5f;
- float dollarToYuan = 2;
- float rubleToDollar = 2;
- float rubleToYuan = 4;
- string menuInput;
- bool isWorks = true;
- while (isWorks)
- {
- Console.WriteLine($" У вас на счету :\n РУБЛИ - {ruble}\n ДОЛЛАРЫ - {dollar}\n ЮАНИ - {yuan}");
- Console.Write($" Меню\n{CommandYuanToRuble})Юани в Рубли.\n{CommandYuanToDollar})Юани в Доллары.\n{CommandDollarToRuble})Доллары в рубли." +
- $"\n{CommandDollarToYuan})Доллары в юани.\n{CommandRubleToDollar})Рубли в доллары.\n{CommandRubleToYuan})Рубли в Юани.\n{CommandExit})Выход" +
- $"\n Укажите номер операции : ");
- menuInput = Console.ReadLine();
- switch (menuInput)
- {
- case CommandYuanToRuble:
- Console.Write("Сколько юаней обменять в рубли :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (yuan >= temporaryCurrency)
- {
- yuan -= temporaryCurrency;
- ruble += temporaryCurrency * yuanToRuble;
- }
- else
- {
- Console.WriteLine("Недостаточно средств для операции.");
- Console.Read();
- }
- break;
- case CommandYuanToDollar:
- Console.Write("Сколько юаней обменять на доллары :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (yuan >= temporaryCurrency)
- {
- yuan -= temporaryCurrency;
- dollar += temporaryCurrency * yuanToDollar;
- }
- else
- {
- Console.WriteLine("Недостаточно средств лоя операции.");
- Console.Read();
- }
- break;
- case CommandDollarToRuble:
- Console.Write("Сколько долларов обменять на рубли :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (dollar >= temporaryCurrency)
- {
- dollar -= temporaryCurrency;
- ruble += temporaryCurrency * dollarToRuble;
- }
- else
- {
- Console.WriteLine("Недостаточно средств лоя операции.");
- Console.Read();
- }
- break;
- case CommandDollarToYuan:
- Console.Write("Сколько долларов обменять на юани :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (dollar >= temporaryCurrency)
- {
- dollar -= temporaryCurrency;
- yuan += temporaryCurrency * dollarToYuan;
- }
- else
- {
- Console.WriteLine("Недостаточно средств лоя операции.");
- Console.Read();
- }
- break;
- case CommandRubleToDollar:
- Console.Write("Сколько рублей обменять на доллары :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (ruble >= temporaryCurrency)
- {
- ruble -= temporaryCurrency;
- dollar += temporaryCurrency * rubleToDollar;
- }
- else
- {
- Console.WriteLine("Недостаточно средств лоя операции.");
- Console.Read();
- }
- break;
- case CommandRubleToYuan:
- Console.Write("Сколько рублей обменять на юани :");
- temporaryCurrency = Convert.ToInt32(Console.ReadLine());
- if (ruble >= temporaryCurrency)
- {
- ruble -= temporaryCurrency;
- yuan += temporaryCurrency * rubleToYuan;
- }
- else
- {
- Console.WriteLine("Недостаточно средств лоя операции.");
- Console.Read();
- }
- break;
- case CommandExit:
- Console.WriteLine();
- isWorks = false;
- break;
- }
- Console.Clear();
- }
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment