maus234

Untitled

Aug 27th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Leson01
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int rubToUsd = 40, usdToRub = 44, rubToUah = 10, uahToRub = 13, uahToUsd = 25, usdToUah = 27;
  14.             float rub;
  15.             float usd;
  16.             float uah;
  17.             string userInput;
  18.             float currencyCount;
  19.             Console.WriteLine("Добро пожаловать в обменик!");
  20.             Console.WriteLine("У нас вы можыте поменять гривну в рубли и в долары. И тоже самое вы можыте совершыть и с рублем и доларом ");
  21.             Console.Write("Видите ваш баланс рублей:");
  22.             rub = Convert.ToSingle(Console.ReadLine());
  23.             Console.Write("Видите ваш баланс долоров:");
  24.             usd = Convert.ToSingle(Console.ReadLine());
  25.             Console.Write("Видите ваш баланс гривен:");
  26.             uah = Convert.ToSingle(Console.ReadLine());
  27.             Console.WriteLine("1 - обменять рубли в долары либо в гривны");
  28.             Console.WriteLine("2 - обменять долары в гривны либо в рубли");
  29.             Console.WriteLine("3 - обменять гривны в долары либо в рубли");
  30.             userInput = Console.ReadLine();
  31.  
  32.             while (userInput != "ext")
  33.             {
  34.                 if (userInput == "1")
  35.                 {
  36.                     Console.WriteLine("1 - обменять рубли в долары");
  37.                     Console.WriteLine("2 - обменять рубли в гривны");
  38.                     userInput = Console.ReadLine();
  39.                     if (userInput == "1")
  40.                     {
  41.                         Console.WriteLine("Сколько вы хотите обменять ?");
  42.                         currencyCount = Convert.ToSingle(Console.ReadLine());
  43.                         if (usd >= currencyCount)
  44.                         {
  45.                             usd -= currencyCount;
  46.                             rub += currencyCount * usdToRub;
  47.                             break;
  48.                         }
  49.                         else
  50.                         {
  51.                             Console.WriteLine("Недостаточно средств");
  52.                             break;
  53.                         }
  54.                     }
  55.                     else if (userInput == "2")
  56.                     {
  57.                         Console.WriteLine("Сколько вы хотите обменять ?");
  58.                         currencyCount = Convert.ToSingle(Console.ReadLine());
  59.                         if (usd >= currencyCount)
  60.                         {
  61.                             rub -= currencyCount;
  62.                             rub += currencyCount / rubToUah;
  63.                             break;
  64.                         }
  65.                         else
  66.                         {
  67.                             Console.WriteLine("Недостаточно средств");
  68.                             break;
  69.                         }
  70.                     }
  71.                 }
  72.                 else if (userInput == "2")
  73.                 {
  74.  
  75.                 }    
  76.             }
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment