Advertisement
Guest User

Calculator in console by raxe modz

a guest
Apr 25th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 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.  
  7. namespace Case
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. userStart:
  14. Console.Write("User : ");
  15. string user = Console.ReadLine();
  16. if(user == "raxemodz")
  17. {
  18. passwordStart:
  19. Console.Write("Password : ");
  20. string password = Console.ReadLine();
  21. if(password == "lovemyself")
  22. {
  23. calculatorStart:
  24. Console.Clear();
  25. Console.WriteLine("Hello, " + user + " and welcome to my first calculator");
  26. Console.WriteLine("-------------------------------------------------------------");
  27. Console.WriteLine("1. Addition\n2. Substraction\n3. Division\n4. Multiplication");
  28. Console.Write("Choise : ");
  29. string choise = Console.ReadLine();
  30. if(choise == "1")
  31. {
  32. additionStart:
  33. int numberOne;
  34. int numbersTwo;
  35.  
  36. Console.Clear();
  37. Console.WriteLine("-----------------------------");
  38. Console.Write("Number one : ");
  39. numberOne = Convert.ToInt32(Console.ReadLine());
  40. Console.Write("Numbers two : ");
  41. numbersTwo = Convert.ToInt32(Console.ReadLine());
  42. Console.WriteLine("Result : " + (numberOne + numbersTwo));
  43. Console.WriteLine("-----------------------------");
  44. string exit = Console.ReadLine();
  45. if(exit == "exit")
  46. {
  47. System.Console.ReadKey();
  48. goto calculatorStart;
  49. }
  50. System.Console.ReadKey();
  51. goto additionStart;
  52. }
  53. else if(choise == "2")
  54. {
  55. substractionStart:
  56. int numberOne;
  57. int numbersTwo;
  58.  
  59. Console.Clear();
  60. Console.WriteLine("-----------------------------");
  61. Console.Write("Number one : ");
  62. numberOne = Convert.ToInt32(Console.ReadLine());
  63. Console.Write("Numbers two : ");
  64. numbersTwo = Convert.ToInt32(Console.ReadLine());
  65. Console.WriteLine("Result : " + (numberOne - numbersTwo));
  66. Console.WriteLine("-----------------------------");
  67. if (exit == "exit")
  68. {
  69. System.Console.ReadKey();
  70. goto calculatorStart;
  71. }
  72. System.Console.ReadKey();
  73. goto substractionStart;
  74. }
  75. else if(choise == "3")
  76. {
  77. divisionStart:
  78. int numberOne;
  79. int numbersTwo;
  80.  
  81. Console.Clear();
  82. Console.WriteLine("-----------------------------");
  83. Console.Write("Number one : ");
  84. numberOne = Convert.ToInt32(Console.ReadLine());
  85. Console.Write("Numbers two : ");
  86. numbersTwo = Convert.ToInt32(Console.ReadLine());
  87. Console.WriteLine("Result : " + (numberOne + numbersTwo));
  88. Console.WriteLine("-----------------------------");
  89. if (exit == "exit")
  90. {
  91. System.Console.ReadKey();
  92. goto calculatorStart;
  93. }
  94. System.Console.ReadKey();
  95. goto divisionStart;
  96. }
  97. else if(choise == "4")
  98. {
  99. multiplicationStart:
  100. int numberOne;
  101. int numbersTwo;
  102.  
  103. Console.Clear();
  104. Console.WriteLine("-----------------------------");
  105. Console.Write("Number one : ");
  106. numberOne = Convert.ToInt32(Console.ReadLine());
  107. Console.Write("Numbers two : ");
  108. numbersTwo = Convert.ToInt32(Console.ReadLine());
  109. Console.WriteLine("Result : " + (numberOne + numbersTwo));
  110. Console.WriteLine("-----------------------------");
  111. if (exit == "exit")
  112. {
  113. System.Console.ReadKey();
  114. goto calculatorStart;
  115. }
  116. System.Console.ReadKey();
  117. goto multiplicationStart;
  118. }
  119. else
  120. {
  121. Console.WriteLine("Wrong value please try again.");
  122. System.Console.ReadKey();
  123. goto calculatorStart;
  124. }
  125. }
  126. else
  127. {
  128. Console.WriteLine("Wrong password please try again.");
  129. System.Console.ReadKey();
  130. goto passwordStart;
  131. }
  132. }
  133. else
  134. {
  135. Console.WriteLine("Wrong user please try again.");
  136. System.Console.ReadKey();
  137. goto userStart;
  138. }
  139. Console.ReadLine();
  140. }
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement