-
-
Save GeriG34/b6c291bd627948719358bcfda82ac9da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp7 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
double ruble; | |
double dollar; | |
double euro; | |
double quantity; | |
string userInput; | |
bool isProgramm = true; | |
bool isWork = true; | |
Console.WriteLine("Сколько у Вас рублей?"); | |
ruble = Convert.ToInt32(Console.ReadLine()); | |
if (ruble < 0) | |
{ | |
Console.WriteLine("Баланс должен быть положительным"); | |
ruble = Convert.ToInt32(Console.ReadLine()); | |
Console.WriteLine("Обезьяна....."); | |
} | |
Console.WriteLine("Сколько у Вас долларов?"); | |
dollar = Convert.ToInt32(Console.ReadLine()); | |
if (dollar < 0) | |
{ | |
Console.WriteLine("Баланс должен быть положительным"); | |
dollar = Convert.ToInt32(Console.ReadLine()); | |
Console.WriteLine("Обезьяна....."); | |
} | |
Console.WriteLine("Солько у Вас евро?"); | |
euro = Convert.ToInt32(Console.ReadLine()); | |
if (euro < 0) | |
{ | |
Console.WriteLine("Баланс должен быть положительным"); | |
euro = Convert.ToInt32(Console.ReadLine()); | |
Console.WriteLine("Обезьяна....."); | |
} | |
double wellDollRub = 96.92; | |
double wellRubDoll = 0.0103; | |
double wellEuroRub = 100.17; | |
double wellRubEuro = 0.099; | |
double wellDollEuro = 0.967; | |
double wellEuroDoll = 1.033; | |
const string dollarInRuble = "1"; | |
const string rubleInDollar = "2"; | |
const string euroInRuble = "3"; | |
const string rubleInEuro = "4"; | |
const string dollarInEuro = "5"; | |
const string euroInDollar = "6"; | |
const string exit = "7"; | |
while (isProgramm) | |
{ | |
Console.WriteLine("Что хотите конвертировать?"); | |
Console.WriteLine($"{dollarInRuble} Доллары в рубли"); | |
Console.WriteLine($"{rubleInDollar} Рубли в доллары"); | |
Console.WriteLine($"{euroInRuble} Евро в рубли"); | |
Console.WriteLine($"{rubleInEuro} Рубли в евро"); | |
Console.WriteLine($"{dollarInEuro} Доллары в евро"); | |
Console.WriteLine($"{euroInDollar} Евро в доллары"); | |
Console.WriteLine($"{exit} Выход"); | |
userInput = Console.ReadLine(); | |
if (userInput == "7") { break; } | |
Console.WriteLine("Сколько хотите перевести?"); | |
quantity = Convert.ToDouble(Console.ReadLine()); | |
if (quantity < 0) | |
{ | |
Console.WriteLine("Количество должено быть положительным"); | |
break; | |
} | |
switch (userInput) | |
{ | |
case dollarInRuble: | |
if (quantity <= dollar) | |
{ | |
dollar = dollar - quantity; | |
ruble = ruble + quantity * wellDollRub; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
case rubleInDollar: | |
if (quantity <= ruble) | |
{ | |
ruble = ruble - quantity; | |
dollar = dollar + quantity * wellRubDoll; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
case euroInRuble: | |
if (quantity <= euro) | |
{ | |
euro = euro - quantity; | |
ruble = ruble + quantity * wellEuroRub; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
case rubleInEuro: | |
if (quantity <= ruble) | |
{ | |
ruble = ruble - quantity; | |
euro = euro + quantity * wellRubEuro; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
case dollarInEuro: | |
if (quantity <= dollar) | |
{ | |
dollar = dollar - quantity; | |
euro = euro + quantity * wellDollEuro; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
case euroInDollar: | |
if (quantity <= dollar) | |
{ | |
euro = euro - quantity; | |
dollar = dollar + quantity * wellEuroDoll; | |
break; | |
} | |
else { Console.WriteLine("Не борзей"); break; } | |
default: | |
Console.WriteLine("Не найдена команда"); | |
break; | |
} | |
Console.WriteLine($"У Вас {ruble} рублей"); | |
Console.WriteLine($"У Вас {dollar} долларов"); | |
Console.WriteLine($"У Вас {euro} евро"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment