Advertisement
Guest User

sdasda

a guest
Sep 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. void Dane(int &m, float tab_wsp[], float &xx)
  7. {
  8. cout<<"Podaj stopien wielomianu: ";
  9. cin>>m;
  10. cout<<"Podaj kolejno wspolczynniki: "<<endl;
  11. }
  12. for (int i=0 ; i<=m; i++)
  13. {
  14. cout <<"a"<<i<<"=";
  15. cin>> tab_wsp[i];
  16. }
  17. cout<<"Podaj wartosc x=";
  18. cin>>xx;
  19. }
  20.  
  21. float Horner(int &m, float tab_wsp[], float xx)
  22. {
  23. int i;
  24. float wartosc = tab_wsp[0];
  25. for(int i=0; i<=k; i++)
  26. wartosc=wartosc*xx+tab_wsp[i];
  27. return wartosc;
  28. }
  29. float wsp[20];
  30. float x,w;
  31. int n;
  32.  
  33.  
  34. int main()
  35. {
  36. Dane(n,wsp,x);
  37. w=Horner(n,wsp,x);
  38. cout<<"w"<<"("<<x<<") = " <<w;
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement