Advertisement
Mattykurlzz

Untitled

Jun 14th, 2021
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <math.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. double* ellips(int a, int b)
  7.  
  8. {
  9. double S, L;
  10. const double Pi = 3.14159;
  11. S = Pi * a * b;
  12. L = 2 * Pi * pow((1 / 2 * (pow(a, 2) + pow(b, 2))), (1 / 2));
  13. double* mas = new double [2];
  14. mas [0] = S;
  15. mas [1] = L;
  16. return mas;
  17. }
  18.  
  19. int main()
  20. {
  21. double a, b;
  22.  
  23. cout << "a=";
  24. cin >> a;
  25.  
  26. cout << "\nb=";
  27. cin >> b;
  28. double* ptr;
  29. ptr = ellips(a, b);
  30. cout << "S=" << ptr[0];
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement