Advertisement
Guest User

fffffffffffffff

a guest
Dec 20th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Threading;
  7.  
  8. namespace Magic8Ball
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. programname();
  15. // Variables
  16. Random randomObj = new Random(); // random gen
  17. ConsoleColor oldColor = Console.ForegroundColor; // old color
  18.  
  19.  
  20. while (true) // make sure everything repeats
  21. {
  22. int randomNumber = randomObj.Next(4) + 1; // random var
  23. returncolor();
  24. Console.Write("Ask a question?: ");
  25. Console.ForegroundColor = oldColor;
  26. String yourquestion = Console.ReadLine();
  27. returnnewcolor();
  28. if (yourquestion.ToLower() == "quit")
  29. {
  30. break;
  31.  
  32. }
  33. if (yourquestion.ToLower() == "you suck")
  34. {
  35. Console.WriteLine("You suck even more. Bye.");
  36. break;
  37. }
  38. if (yourquestion.ToLower() == "clear")
  39. {
  40. Console.Clear();
  41. continue;
  42. }
  43. if (yourquestion.ToLower() == "")
  44. {
  45. Console.WriteLine("You need to enter a question fool!");
  46. continue;
  47. }
  48. if (yourquestion.ToLower() == "cls")
  49. {
  50. Console.Clear();
  51. continue;
  52. }
  53.  
  54. switch (randomNumber)
  55. {
  56. case 1:
  57. Console.WriteLine("YES!");
  58. break;
  59. case 2:
  60. Console.WriteLine("NO!");
  61. break;
  62. case 3:
  63. Console.WriteLine("HELL NO!");
  64. break;
  65. case 4:
  66. Console.WriteLine("OMG YES!");
  67. break;
  68. default:
  69. Console.WriteLine("Ask again later.");
  70. break;
  71.  
  72. }
  73.  
  74. }
  75. // back to regular code here
  76. Console.ForegroundColor = ConsoleColor.Green; // text color
  77. Console.Write("\n\n");
  78.  
  79.  
  80. }
  81. static void programname()
  82. {
  83. Console.WriteLine("Magic 8 Ball by Preston Cammarata");
  84. }
  85. static void returncolor()
  86. {
  87. Console.ForegroundColor = ConsoleColor.Green; // text color
  88. }
  89. static void returnnewcolor()
  90. {
  91. Console.ForegroundColor = ConsoleColor.Red; // text color again
  92. }
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement