Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Задача_2._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool a = true;
- float dollar = 100f;
- float rubles = 10000f;
- float bel_rubles = 300f;
- float kolichestvo;
- float kolichestvo2;
- int choice1;
- while (a)
- {
- Console.WriteLine("У вас на счету " + dollar + " долларов и " + rubles + " рублей и " + bel_rubles + " белорусских рублей.");
- Console.WriteLine("Какую валюту хотите обменять?");
- Console.WriteLine("1. Доллары (1 доллар стоит 60 рублей и 2 бел. рубля.)");
- Console.WriteLine("2. Рубли (1 рубль стоит 1/60 рубля и 1/30 бел. рубля.)");
- Console.WriteLine("3. Белорусские Рубли (1 бел. рубль стоит 1/2 доллара и 30 рублей.)");
- Console.WriteLine("4. Закончить обмен");
- Console.Write("Выберите действие, введя цифру: ");
- choice1 = Convert.ToInt32(Console.ReadLine());
- if (choice1 != 1 && choice1 != 2 && choice1 != 3 && choice1 != 4)
- {
- Console.WriteLine("Неверный ввод.");
- continue;
- }
- else if (choice1 == 4)
- {
- Console.WriteLine("Вы кончили.");
- Console.WriteLine("(Нажмите Enter, чтобы продолжить.)");
- Console.ReadLine();
- break;
- }
- else
- {
- Console.WriteLine("Сколько денег хотите перевести?");
- kolichestvo2 = Convert.ToInt32(Console.ReadLine());
- kolichestvo = kolichestvo2;
- if (choice1 == 1)
- {
- if (kolichestvo > dollar)
- {
- Console.WriteLine("Неверный ввод");
- continue;
- }
- if (kolichestvo <= dollar)
- {
- }
- }
- if (choice1 == 2)
- {
- if (kolichestvo > rubles)
- {
- Console.WriteLine("Неверный ввод");
- }
- if (kolichestvo <= rubles)
- {
- }
- }
- if (choice1 == 3)
- {
- if (kolichestvo > bel_rubles)
- {
- Console.WriteLine("Неверный ввод");
- }
- if (kolichestvo <= bel_rubles)
- {
- }
- }
- Console.WriteLine("В какую валюту хотите перевести?");
- Console.WriteLine("1. Доллары");
- Console.WriteLine("2. Рубли");
- Console.WriteLine("3. Белорусские Рубли");
- Console.Write("Выберите действие, введя цифру: ");
- int choice2 = Convert.ToInt32(Console.ReadLine());
- if (choice2 != 1 && choice2 != 2 && choice2 != 3)
- {
- Console.WriteLine("Неверно.");
- continue;
- }
- else
- {
- if (choice1 == 1 && choice2 == 1)
- {
- Console.WriteLine("Нет смысла обменивать доллары в доллары");
- }
- else if (choice1 == 1 && choice2 == 2)
- {
- dollar = dollar - kolichestvo;
- rubles = rubles + kolichestvo * 60;
- }
- else if (choice1 == 1 && choice2 == 3)
- {
- dollar = dollar - kolichestvo;
- bel_rubles = bel_rubles + kolichestvo * 2;
- }
- else if (choice1 == 2 && choice2 == 1)
- {
- rubles = rubles - kolichestvo;
- dollar = dollar + kolichestvo / 60;
- }
- else if (choice1 == 2 && choice2 == 2)
- {
- Console.WriteLine("Нет смысла обменивать рубли в рубли");
- }
- else if (choice1 == 2 && choice2 == 3)
- {
- rubles = rubles - kolichestvo;
- bel_rubles = bel_rubles + kolichestvo / 30;
- }
- else if (choice1 == 3 && choice2 == 1)
- {
- bel_rubles = bel_rubles - kolichestvo;
- dollar = dollar + kolichestvo / 2;
- }
- else if (choice1 == 3 && choice2 == 2)
- {
- bel_rubles = kolichestvo;
- rubles = rubles + kolichestvo * 30;
- }
- else if (choice1 == 3 && choice2 == 3)
- {
- Console.WriteLine("Нет смысла обменивать бел. рубли в бел. рубли");
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement