Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. double wyrazenie1(double liczba1, double liczba2){
  8. return sqrt(liczba1) + liczba2;
  9. }
  10.  
  11. double wyrazenie2(double liczba1, double liczba2){
  12.  
  13. if(liczba2!=0){
  14. return liczba1/liczba2;
  15. }else {
  16. return 0;
  17. }
  18. }
  19.  
  20.  
  21. double wyrazenie3(double liczba1, double liczba2){
  22. return pow(liczba1, liczba2);
  23. }
  24.  
  25.  
  26.  
  27. double wyrazenie4(double liczba1, double liczba2){
  28.  
  29. if(liczba1>0){
  30. return (liczba1+liczba2)/sqrt(liczba1);
  31. }else {
  32. return 0;
  33. }
  34. }
  35.  
  36.  
  37. double wyrazenie5(double liczba1, double liczba2){
  38.  
  39. if(liczba2>0){
  40. return pow(liczba1,sqrt(liczba2) )/liczba2;
  41. }else{
  42. return 0;
  43. }
  44. }
  45.  
  46.  
  47.  
  48. int main()
  49. {
  50. double liczba1, liczba2;
  51. cout << "Kalkulator powtorzenie" << endl;
  52.  
  53. cout << "-------------------------" << endl;
  54. cout << "Podaj liczbe1="; cin >> liczba1;
  55. cout << "Podaj liczbe2="; cin >> liczba2;
  56. cout << "-------------------------" << endl;
  57.  
  58. cout << "Wynik WYRAZENIE1=" << wyrazenie1(liczba1, liczba2) << endl;
  59. cout << "-------------------------" << endl;
  60.  
  61. cout << "Wynik WYRAZENIE2=" << wyrazenie2(liczba1, liczba2) << endl;
  62. cout << "-------------------------" << endl;
  63.  
  64. cout << "Wynik WYRAZENIE3=" << wyrazenie3(liczba1, liczba2) << endl;
  65. cout << "-------------------------" << endl;
  66.  
  67. cout << "Wynik WYRAZENIE4=" << wyrazenie4(liczba1, liczba2) << endl;
  68. cout << "-------------------------" << endl;
  69.  
  70. system("pause");
  71. return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement