Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1.  
  2. int funct1(int x, int y) {
  3.     int ans = 0;
  4.    
  5.     if (y < 0) {
  6.             ans = 1 / (std::pow(x, y));
  7.     }
  8.     else
  9.         ans = pow(x, y);
  10.  
  11.     return ans;
  12.  
  13. }
  14.  
  15. double funct2(int x, int y) {
  16.  
  17.     if (y == 1)  
  18.         return 1;
  19.     else
  20.         return (double)x / y + funct2(x, y - 1);  
  21.  
  22. }double funct3(int x, int y) {
  23.  
  24.     if (y == 1)  
  25.         return 1;
  26.     else
  27.         return (double)x / y + funct3(x, y - 1);  
  28.  
  29. }
  30.  
  31. bool die(const std::string & msg)
  32. {
  33.     std::cout << msg << std::endl;
  34.     system("pause");
  35.     exit(EXIT_FAILURE);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement