Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- void Dane(int &m, float tab_wsp[], float &xx)
- {
- cout<<"Podaj stopien wielomianu: ";
- cin>>m;
- cout<<"Podaj kolejno wspolczynniki: "<<endl;
- }
- for (int i=0 ; i<=m; i++)
- {
- cout <<"a"<<i<<"=";
- cin>> tab_wsp[i];
- }
- cout<<"Podaj wartosc x=";
- cin>>xx;
- }
- float Horner(int &m, float tab_wsp[], float xx)
- {
- int i;
- float wartosc = tab_wsp[0];
- for(int i=0; i<=k; i++)
- wartosc=wartosc*xx+tab_wsp[i];
- return wartosc;
- }
- float wsp[20];
- float x,w;
- int n;
- int main()
- {
- Dane(n,wsp,x);
- w=Horner(n,wsp,x);
- cout<<"w"<<"("<<x<<") = " <<w;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement