Guest User

Untitled

a guest
Jun 19th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. // csc.exe /t:exe /out:L:\cs_source\MyApplication.exe L:\cs_source\program1.cs
  2. using System;
  3. namespace HelloWorld
  4. {
  5. public class Hello
  6. {
  7. static void Main()
  8. {
  9. Console.WriteLine("Welcome to the Online Gaming Forum!");
  10. string name;
  11. int age;
  12. Console.Write("Enter your name: ");
  13. name = Console.ReadLine();
  14. Console.WriteLine("How old are you, {0}?", name);
  15. age = int.Parse(Console.ReadLine());
  16. Console.WriteLine("Let's play a game, {0}", name);
  17. Console.WriteLine("I will guess a number between 1 and 100");
  18. Console.WriteLine("All you need to do, {0}, is say whether my number is closer to 1 or 100", name);
  19. Console.WriteLine("If you win, {0}, you will get a fabulous prize!", name);
  20. // int playAgainCode = 0;
  21.  
  22.  
  23. Console.WriteLine("OK, {0}, Let's Go! Enter you GUESS. Enter either the number 1 or 100, {0}", name);
  24. int players_number = int.Parse(Console.ReadLine());
  25. // if (players_number == -1)
  26. // {
  27. // break;
  28. // }
  29. // Now get the computer's number;
  30. Random rnd = new Random();
  31. int computer_guess = rnd.Next(1, 100);
  32. Console.WriteLine("Here is my number, {0}: {1}", name, computer_guess);
  33.  
  34. if (computer_guess < 50 && players_number == 1)
  35. {
  36. Console.WriteLine("Player WINS!!!");
  37.  
  38. }
  39. else if (computer_guess >= 50 && players_number == 100)
  40. {
  41. Console.WriteLine("Player WINS!!!");
  42.  
  43. }
  44. else
  45. {
  46. Console.WriteLine("Player loses!!!");
  47. }
  48. //Console.WriteLine("Play again, {0} ?", name);
  49. //playAgainCode = int.Parse(Console.ReadLine());
  50.  
  51. }
  52.  
  53. static void give_Advice(string name, int age)
  54. {
  55. Console.WriteLine("As to your Prize - Honestly, {0}, at the Sweet Age of {1}, you should know better than to believe vague promises...", name, age.ToString());
  56. }
  57.  
  58. }
  59. }
Add Comment
Please, Sign In to add comment