-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson04.cs
More file actions
40 lines (25 loc) · 1.37 KB
/
Lesson04.cs
File metadata and controls
40 lines (25 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
namespace Tired
{
class Program
{
static void Main(string[] args)
{
int crystalPrice = new Random().Next(15, 50);
int crystalsToBuy = 0;
int currentGoldCount = 0;
int currentCrystalsCount = 0;
Console.WriteLine("У данного торговца цена кристалла составляет:" + crystalPrice);
Console.Write("Введите начальное количество золота:");
currentGoldCount = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Принято\nВведите количество алмазов, которое вы хотите купить:");
crystalsToBuy = Convert.ToInt32(Console.ReadLine());
int dealPrice = crystalsToBuy * crystalPrice;
Console.WriteLine("Вы отдатите " + dealPrice + " золота за " + crystalsToBuy + ", совершить сделку?\n(Нажмите что нибудь)");
Console.ReadLine();
currentGoldCount = currentGoldCount - dealPrice;
currentCrystalsCount += crystalsToBuy;
Console.WriteLine("Вы прибрели " + crystalsToBuy + " алмазов!\nТекущее золото:" + currentGoldCount);
}
}
}