PRO100LY4UK

1.7

Aug 15th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp5
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int playersGold = 100;               //золото игрока изначально
  10.             int playersCrystals = 0;             //кристалы игрока изначально
  11.             int crystalsForOneGold = 20;        //Цена одного золота в кристалах
  12.             string firstOffer;                  //Приветствие, цена
  13.             string playersGoldInStart;          //У вас есть столькото золота
  14.             string howMatchWantToBuy = "Введите количество золота для покупки кристалов(число):";
  15.             string playerNowHave;               //конечная фраза
  16.             string countToBuy;                  //сколько купить
  17.             int intCountToBuy;
  18.  
  19.  
  20.             firstOffer = "Здравствуйте, сегодня за единицу золота даем " + crystalsForOneGold + " кристалов.";
  21.             playersGoldInStart = "У вас есть: " + playersCrystals + " кристалов и " + playersGold + " золота.";
  22.  
  23.  
  24.             Console.WriteLine(firstOffer);
  25.             Console.WriteLine(playersGoldInStart);
  26.             Console.Write(howMatchWantToBuy);
  27.             countToBuy = Console.ReadLine();
  28.             intCountToBuy = Convert.ToInt32(countToBuy);
  29.             playersGold -= intCountToBuy;
  30.             playersCrystals += crystalsForOneGold * intCountToBuy;
  31.             playerNowHave = "Спасибо за покупку! " + "Теперь у вас есть " + intCountToBuy * crystalsForOneGold + " кристаллов и " + playersGold + " золота.";
  32.             Console.WriteLine(playerNowHave);
  33.         }
  34.     }
  35. }
Add Comment
Please, Sign In to add comment