Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http.Headers;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp12
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const int CommandDollarToRuble = 1;
- const int CommandYuanToRuble = 2;
- const int CommandDollarToYuan = 3;
- const int CommandRubleToYuan = 4;
- const int CommandRubleToDollar = 5;
- const int CommandYuanToDollar = 6;
- const int CommandExit = 7;
- float rubleWallet = 1000;
- float dollarWallet = 1000;
- float yuanWallet = 1000;
- float dollarToRuble = 0.5f;
- float yuanToRuble = 0.25f;
- float dollarToYuan = 2f;
- float rubleToYuan = 4f;
- float rubleToDollar = 2f;
- float yuanToDollar = 0.5f;
- bool isWork = true;
- int userInput;
- while (isWork)
- {
- Console.WriteLine($"Баланс : рубли : {rubleWallet}, доллары : {dollarWallet}, юани : {yuanWallet}.");
- Console.WriteLine($"Какой обмен вас интересует :\n {CommandDollarToRuble})Доллары на рубли\n {CommandYuanToRuble})Юани на рубли\n " +
- $"{CommandRubleToYuan})Рубли на юани\n {CommandDollarToYuan})Доллары на юани\n {CommandRubleToDollar})Рубли на доллары\n " +
- $"{CommandYuanToDollar})Юани на доллары\n {CommandExit})Выход");
- userInput = Convert.ToInt32(Console.ReadLine());
- switch (userInput)
- {
- case CommandDollarToRuble:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < dollarWallet)
- {
- dollarWallet -= userInput;
- rubleWallet += userInput * dollarToRuble;
- }
- break;
- case CommandYuanToRuble:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < yuanWallet)
- {
- yuanWallet -= userInput;
- rubleWallet += userInput * yuanToRuble;
- }
- break;
- case CommandDollarToYuan:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < dollarWallet)
- {
- dollarWallet -= userInput;
- yuanWallet += userInput * dollarToYuan;
- }
- break;
- case CommandRubleToYuan:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < rubleWallet)
- {
- rubleWallet -= userInput;
- yuanWallet += userInput * rubleToYuan;
- }
- break;
- case CommandRubleToDollar:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < rubleWallet)
- {
- rubleWallet -= userInput;
- dollarWallet += userInput * rubleToDollar;
- }
- break;
- case CommandYuanToDollar:
- Console.Write("Сколько валюты обменять : ");
- userInput = Convert.ToInt32(Console.ReadLine());
- if (userInput < yuanWallet)
- {
- yuanWallet -= userInput;
- dollarWallet += userInput * yuanToDollar;
- }
- break;
- case CommandExit:
- isWork = false;
- break;
- }
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment