Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Dynamic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- float rubToUsd = 71.21F, usdToRub = 68.16F, rubToEur = 80.49F, eurToRub = 77.04F, usdToEur = 1.1060F, eurToUsd = 1.1510F;
- float rub, usd, eur, currencyCount;
- string comand;
- Console.Write("Введите баланс долларов:");
- usd = Convert.ToSingle(Console.ReadLine());
- Console.Write("Введите баланс рублей:");
- rub = Convert.ToSingle(Console.ReadLine());
- Console.Write("Введите баланс евро:");
- eur = Convert.ToSingle(Console.ReadLine());
- Console.WriteLine("Добро пожаловать в обменник, у нас вы можете обменять три валютные пары(usd/rub/eur)");
- while (true)
- {
- Console.WriteLine("Обменять доллары на рубли - 1 ");
- Console.WriteLine("Обменять рубли на доллары - 2");
- Console.WriteLine("Обменять рубли на евро - 3");
- Console.WriteLine("Обменять евро на рубли - 4");
- Console.WriteLine("Обменять доллары на евро - 5");
- Console.WriteLine("Обменять евро на доллары - 6");
- Console.WriteLine("Выйти из обменника - 7");
- Console.WriteLine($"Текуший баланс: {rub} рублей,{usd} долларов, {eur} евро");
- comand = Console.ReadLine();
- if(comand == "7")
- {
- break;
- }
- else if(comand == "1")
- {
- Console.Write("Какое количество долларов вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if(usd >= currencyCount)
- {
- usd -= currencyCount;
- rub += currencyCount * usdToRub;
- }
- else
- {
- Console.Write("Недопустимое значение долларов.");
- }
- }
- else if (comand == "2")
- {
- Console.Write("Какое количество рублей вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (rub >= currencyCount)
- {
- rub -= currencyCount;
- usd += currencyCount / rubToUsd;
- }
- else
- {
- Console.Write("Недопустимое значение рублей.");
- }
- }
- else if (comand == "3")
- {
- Console.Write("Какое количество рублей вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (rub >= currencyCount)
- {
- rub -= currencyCount;
- eur += currencyCount / rubToEur;
- }
- else
- {
- Console.Write("Недопустимое значение рублей.");
- }
- }
- else if (comand == "4")
- {
- Console.Write("Какое количество евро вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (rub >= currencyCount)
- {
- eur -= currencyCount;
- rub += currencyCount * eurToRub;
- }
- else
- {
- Console.Write("Недопустимое значение евро.");
- }
- }
- else if (comand == "5")
- {
- Console.Write("Какое количество долларов вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (rub >= currencyCount)
- {
- usd -= currencyCount;
- eur += currencyCount / usdToEur;
- }
- else
- {
- Console.Write("Недопустимое значение долларов.");
- }
- }
- else if (comand == "6")
- {
- Console.Write("Какое количество евро вы желаете обменять:");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (rub >= currencyCount)
- {
- eur -= currencyCount;
- usd += currencyCount * eurToUsd;
- }
- else
- {
- Console.Write("Недопустимое значение евро.");
- }
- }
- else if (comand != "1" || comand != "2" || comand != "3" || comand != "4" || comand != "5" || comand != "6" || comand != "7")
- {
- Console.WriteLine("Номера операции не существует.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment