Created
April 30, 2021 12:06
-
-
Save Ana19997/45c34d6f5ffa41de14dcf6be8427e8cf 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace магазин | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int golgToCrystals = 5; | |
float gold; | |
float crystals; | |
string userInput = ""; | |
float Count; | |
Console.WriteLine("Приветствуем Вас в магазине. Вы можете купить у нас кристаллы."); | |
Console.WriteLine("Сколько кристаллов Вам требуется:"); | |
crystals = Convert.ToSingle(Console.ReadLine()); | |
Console.WriteLine("Введите количество золота:"); | |
gold = Convert.ToSingle(Console.ReadLine()); | |
switch (userInput) | |
{ | |
case "": | |
Count = Convert.ToSingle(Console.ReadLine()); | |
if (gold >= Count) | |
{ | |
gold -= Count; | |
crystals += Count / golgToCrystals; | |
} | |
else | |
{ | |
Console.WriteLine("Недопустимое количество"); | |
} | |
break; | |
} | |
Console.WriteLine("У вас " + gold + "и" + crystals); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment