Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApp1;
- using System.Text;
- public class Task06
- {
- public void Run()
- {
- Console.InputEncoding = Encoding.Unicode;
- Console.OutputEncoding = Encoding.Unicode;
- Console.Write( "Input start gold value : " );
- int goldValue = int.Parse( Console.ReadLine() );
- Console.Write( "Input start crystals value : " );
- int crystalsValue = int.Parse( Console.ReadLine() );
- Console.Write( "Input crystals price : " );
- int crystalPrice = int.Parse( Console.ReadLine() );
- bool canExit = false;
- while ( !canExit )
- {
- Console.WriteLine( $"Gold = {goldValue}, Cry = {crystalsValue}\n" );
- Console.Write( "Buy crystals, input count : " );
- int buyCrystalsCount = int.Parse( Console.ReadLine() );
- goldValue -= buyCrystalsCount * crystalPrice;
- crystalsValue += buyCrystalsCount;
- Console.WriteLine( "Continue? Enter 'n' for exit" );
- string continueAnswer = Console.ReadLine();
- string exitAnswer = "n";
- canExit = string.Equals( continueAnswer, exitAnswer );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement