Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Projekt1_Zawodniak50128
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. ConsoleKeyInfo WybranaFunkcjonalność;
  10. Console.WriteLine("\n\tProgram realizuje wybrane obliczenia");
  11.  
  12. do
  13. {
  14. Console.WriteLine("\n\n\t\t\tMENU (funkcjonalne) PROGRAMU: \n");
  15. Console.WriteLine("\n\tA. Obliczenie pierwiastków równania kwadratowego");
  16. Console.WriteLine("\n\tB. Obliczenie wartości wielomianu n-tego stopnia");
  17. Console.WriteLine("\n\tC. Obliczenie wartości liczby wpisanej znakowo");
  18. Console.WriteLine("\n\tX. Zakończenie (Wyjście z) programu");
  19. Console.Write("\n\tNaciśnieciem klawisza wybierz odpowiednią funkcjonalność" + " programu: ");
  20. WybranaFunkcjonalność = Console.ReadKey();
  21. if (WybranaFunkcjonalność.Key == ConsoleKey.A)
  22. {
  23. Console.WriteLine("\n\n\t\t\t Obliczamy pierwiastki równania kwadratowego! \n");
  24. int jza = 0;
  25. int jzb = 0;
  26. int jzc = 0;
  27. Console.WriteLine("Podaj liczbę a");
  28. jza = Convert.ToInt32(Console.ReadLine());
  29. Console.WriteLine("Podaj liczbę b");
  30. jzb = Convert.ToInt32(Console.ReadLine());
  31. Console.WriteLine("Podaj liczbę c");
  32. jzc = Convert.ToInt32(Console.ReadLine());
  33.  
  34. double d = Math.Sqrt(jzb ^ 2 - 4 * jza * jzc);
  35. Console.WriteLine(d);
  36. if (d > 0)
  37. {
  38.  
  39. }
  40. else if (d == 0)
  41. {
  42.  
  43. }
  44. else
  45. {
  46.  
  47. }
  48. }
  49. else if (WybranaFunkcjonalność.Key == ConsoleKey.B)
  50. {
  51. Console.WriteLine("\n\n\t\t\tObliczamy wartość wielomianu n-tego stopnia!\n");
  52.  
  53. }
  54. else if (WybranaFunkcjonalność.Key == ConsoleKey.C)
  55. {
  56. Console.WriteLine("\n\n\t\t\tObliczamy wartość liczby wpisanej znakowo!\n");
  57.  
  58. }
  59. else if (WybranaFunkcjonalność.Key != ConsoleKey.X)
  60. {
  61. Console.WriteLine("\n\t ERROR: Wybrałeś niedozwolony klawisz!");
  62. Console.Write("\n\tDokonaj wyboru funkcjonalności programu jeszcze raz!\n");
  63. }
  64. } while (WybranaFunkcjonalność.Key != ConsoleKey.X);
  65.  
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement