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 Leson01
- {
- class Program
- {
- static void Main(string[] args)
- {
- int rubToUsd = 40, usdToRub = 44, rubToUah = 10, uahToRub = 13, uahToUsd = 25, usdToUah = 27;
- float rub;
- float usd;
- float uah;
- string userInput;
- float currencyCount;
- Console.WriteLine("Добро пожаловать в обменик!");
- Console.WriteLine("У нас вы можыте поменять гривну в рубли и в долары. И тоже самое вы можыте совершыть и с рублем и доларом ");
- Console.Write("Видите ваш баланс рублей:");
- rub = Convert.ToSingle(Console.ReadLine());
- Console.Write("Видите ваш баланс долоров:");
- usd = Convert.ToSingle(Console.ReadLine());
- Console.Write("Видите ваш баланс гривен:");
- uah = Convert.ToSingle(Console.ReadLine());
- Console.WriteLine("1 - обменять рубли в долары либо в гривны");
- Console.WriteLine("2 - обменять долары в гривны либо в рубли");
- Console.WriteLine("3 - обменять гривны в долары либо в рубли");
- userInput = Console.ReadLine();
- while (userInput != "ext")
- {
- if (userInput == "1")
- {
- Console.WriteLine("1 - обменять рубли в долары");
- Console.WriteLine("2 - обменять рубли в гривны");
- userInput = Console.ReadLine();
- if (userInput == "1")
- {
- Console.WriteLine("Сколько вы хотите обменять ?");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (usd >= currencyCount)
- {
- usd -= currencyCount;
- rub += currencyCount * usdToRub;
- break;
- }
- else
- {
- Console.WriteLine("Недостаточно средств");
- break;
- }
- }
- else if (userInput == "2")
- {
- Console.WriteLine("Сколько вы хотите обменять ?");
- currencyCount = Convert.ToSingle(Console.ReadLine());
- if (usd >= currencyCount)
- {
- rub -= currencyCount;
- rub += currencyCount / rubToUah;
- break;
- }
- else
- {
- Console.WriteLine("Недостаточно средств");
- break;
- }
- }
- }
- else if (userInput == "2")
- {
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment