Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <windows.h>
  4. #include <cstdlib>
  5. using namespace std;
  6. long long a, b, c;
  7. unsigned long x;
  8. void poczatek()
  9. {
  10. cout << "[1] Dodawanie" << endl;
  11. cout << "[2] Odejmowanie" << endl;
  12. cout << "[3] Mnozenie" << endl;
  13. cout << "[4] Dzielenie" << endl;
  14. cout << "[5] potegowanie" << endl;
  15. cout << "[6] Zakoncz" << endl;
  16. }
  17. void dodawanie()
  18. {
  19. cout << "Podaj pierwsza liczbe: ";
  20. cin >> a;
  21. cout << "Podaj druga liczbe: ";
  22. cin >> b;
  23. c=a+b;;
  24. cout << a << " + " << b << " = " <<c <<endl;
  25. }
  26. void odejmowanie()
  27. {
  28. cout << "Podaj pierwsza liczbe: ";
  29. cin >> a;
  30. cout << "Podaj druga liczbe: ";
  31. cin >> b;
  32. c=a-b;
  33. cout << a << " - " << b << " = " <<c <<endl;
  34. }
  35. void mnozenie()
  36. {
  37. cout << "Podaj pierwsza liczbe: ";
  38. cin >> a;
  39. cout << "Podaj druga liczbe: ";
  40. cin >> b;
  41. c=a*b;
  42. cout << a << " * " << b << " = " <<c <<endl;
  43.  
  44. }
  45. void dzielenie()
  46. {
  47. cout << "Podaj pierwsza liczbe: ";
  48. cin >> a;
  49. cout << "Podaj druga liczbe: ";
  50. cin >> b;
  51. c=a/b;
  52. cout << a << " / " << b << " = " <<c <<endl;
  53. }
  54.  
  55. void potegowanie()
  56. {
  57. cout << "Podaj liczbe: ";
  58. cin >> a;
  59. c=a*a;
  60. cout << "potga z " << a << " to " << c <<endl;
  61. }
  62. int main()
  63. {
  64.  
  65. int liczba;
  66. poczatek();
  67. wybor:
  68. cout << "Twoj wybor: ";
  69. cin >> liczba;
  70. do {
  71. switch(liczba)
  72. {
  73. case 1:
  74. dodawanie();
  75. goto wybor;
  76. break;
  77. case 2:
  78. odejmowanie();
  79. goto wybor;
  80. break;
  81. case 3:
  82. mnozenie();
  83. goto wybor;
  84. break;
  85. case 4:
  86. dzielenie(); goto wybor;
  87. break;
  88. case 5:
  89. potegowanie(); goto wybor;
  90. break;
  91. case 6:
  92. break;
  93. default:
  94. cout << "zle polecenie";
  95. }
  96. }while (liczba != 6);
  97. return 0;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement