Advertisement
sergezhu

Untitled

Mar 30th, 2023
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. Console.InputEncoding = Encoding.Unicode;
  2. Console.OutputEncoding = Encoding.Unicode;
  3.  
  4. Console.Write( "Input start gold value : " );
  5. string goldValueRaw = Console.ReadLine();
  6. int goldValue = int.Parse( goldValueRaw );
  7.  
  8. Console.Write( "Input start crystals value : " );
  9. string crystalsValueRaw = Console.ReadLine();
  10. int crystalsValue = int.Parse( crystalsValueRaw );
  11.  
  12. Console.Write( "Input crystals price : " );
  13. string crystalPriceRaw = Console.ReadLine();
  14. int crystalPrice = int.Parse( crystalPriceRaw );
  15.  
  16. bool loopExitFlag = false;
  17.  
  18. while ( !loopExitFlag )
  19. {
  20.     Console.WriteLine( $"Gold = {goldValue}, Cry = {crystalsValue}\n" );
  21.     Console.Write( "Buy crystals, input count : " );
  22.     string buyCrystalsCountRaw = Console.ReadLine();
  23.     int buyCrystalsCount = int.Parse( buyCrystalsCountRaw );
  24.  
  25.     goldValue -= buyCrystalsCount * crystalPrice;
  26.     crystalsValue += buyCrystalsCount;
  27.  
  28.     Console.WriteLine( "Continue? Enter 'n' for exit" );
  29.     string continueAnswer = Console.ReadLine();
  30.     string exitAnswer = "n";
  31.  
  32.     loopExitFlag = string.Equals( continueAnswer, exitAnswer );
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement