Guest User

Untitled

a guest
Nov 19th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double polynom(unsigned, double);
  5.  
  6. int main(void)
  7. {
  8. cout << polynom(2, 3) << endl;
  9. return 0;
  10. }
  11.  
  12. double polynom(unsigned n, double x)
  13. {
  14. double currentAdd(x);
  15. double res(0);
  16. while (n)
  17. {
  18. res += currentAdd;
  19. currentAdd *= currentAdd;
  20. --n;
  21. }
  22. return res;
  23. }
  24.  
  25. using namespace std;
  26.  
  27. double polynom(unsigned, double);
  28.  
  29. polynom(-1, 2); // Compiler is happy to convert that -1 to a very large
  30. // positive number without an y errors. On the reciving
  31. // side you can not tell if it was an error.
  32.  
  33. int main(void)
  34. {
  35. return 0;
  36. }
  37.  
  38. double currentAdd(x);
  39. double res(0);
  40.  
  41. double currentAdd = x;
  42. double res = 0;
  43.  
  44. while (n)
  45. {
  46. --n;
  47. }
  48. // over
  49. for(;n; --n)
  50. {
  51. }
Add Comment
Please, Sign In to add comment