Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 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 ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string password = "";
  14. Console.WriteLine("Witam w aplikacji. Prosze podac haslo:");
  15. password = Console.ReadLine();
  16. int i = 0;
  17. while(i<5)
  18. {
  19. if (password == "haslo")
  20. {
  21. break;
  22. }
  23. i++;
  24. Console.WriteLine("Haslo nieprawidlowe, podaj wlasciwe haslo:");
  25. password = Console.ReadLine();
  26. }
  27. if (i == 5)
  28. {
  29. Console.WriteLine("Wpisano zbyt wiele niepoprawnych hasel.");
  30. }
  31. else
  32. {
  33. Console.WriteLine("Zostales poprawnie zalogowany ;)");
  34.  
  35. while (true)
  36. {
  37. Console.WriteLine("Wybierz bryle:\n1. Kula\n2. Postopadloscian\n3. Szescian\n4. Stozek\n5. Walec\n6. Ostroslup\n7. Wyjscie");
  38. int a;
  39. a = int.Parse(Console.ReadLine());
  40. switch (a)
  41. {
  42. case 1:
  43. double r;
  44. Console.WriteLine("Podaj promien: ");
  45. r = Double.Parse(Console.ReadLine());
  46. r = 4 * 3.14 * r * r;
  47. Console.WriteLine("Twoje pole kuli to: {0}\n\n", r);
  48. break;
  49. case 2:
  50. double y, b, c, pole;
  51. Console.WriteLine("Podaj a: ");
  52. y = Double.Parse(Console.ReadLine());
  53. Console.WriteLine("Podaj b: ");
  54. b = Double.Parse(Console.ReadLine());
  55. Console.WriteLine("Podaj c: ");
  56. c = Double.Parse(Console.ReadLine());
  57. pole = (2 * y * b) + (2 * y * c) + (2 * b * c);
  58. Console.WriteLine("Twoje pole prostopadloscianu {0}\n\n ", pole);
  59. break;
  60. case 3:
  61. double d;
  62. Console.WriteLine("Podaj a: ");
  63. d = Double.Parse(Console.ReadLine());
  64. d = (6 * (d * d));
  65. Console.WriteLine("Twoje pole szescianu: {0}\n\n", d);
  66. break;
  67. case 4:
  68. double h, l, poleStozka;
  69. Console.WriteLine("Podaj h:");
  70. h = Double.Parse(Console.ReadLine());
  71. Console.WriteLine("Podaj l:");
  72. l = Double.Parse(Console.ReadLine());
  73. poleStozka = 3.14 * h * (h + l);
  74. Console.WriteLine("Twoje pole stozka {0}\n\n", poleStozka);
  75. break;
  76. case 5:
  77. double t, u, poleWalca;
  78. Console.WriteLine("Podaj t:");
  79. t = Double.Parse(Console.ReadLine());
  80. Console.WriteLine("Podaj u:");
  81. u = Double.Parse(Console.ReadLine());
  82. poleWalca = 2 * 3.14 * t * (t + u);
  83. Console.WriteLine("Twoje pole Walca {0}\n\n", poleWalca);
  84. break;
  85. case 6:
  86. double m, n, poleOstro;
  87. Console.WriteLine("Podaj a: ");
  88. m = Double.Parse(Console.ReadLine());
  89. Console.WriteLine("Podaj h: ");
  90. n = Double.Parse(Console.ReadLine());
  91. poleOstro = m * m + 2 * (m * n);
  92. Console.WriteLine("Pole ostroslupa wynosi {0}\n\n", poleOstro);
  93. break;
  94. case 7:
  95. string Y = "";
  96. Console.WriteLine("Do zobaczenia nastepny razem.\nNapewno chcesz wyjsc Y/N");
  97. Y= Console.ReadLine();
  98. if (Y == "N" || Y == "n")
  99. {
  100. break;
  101. }
  102. else if (Y == "Y" || Y == "y")
  103. {
  104. System.Environment.Exit(1);
  105. }
  106. break;
  107. }
  108. }
  109. }
  110.  
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement