Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <fstream>
- using namespace std;
- long double df(long double x, long double alfa,long double beta)
- {
- long double a= alfa *(x*x*x*x-beta);
- return a;
- }
- int main() {
- long double x0,y0,x,y,h;
- cout.precision(18);
- cout.setf(ios::fixed);
- x0=0;
- y0=1200;
- cout<<"Podaj czas"<<endl;
- cin>>x;
- cout<<"Podaj skok czasowy"<<endl;
- cin>>h;
- double alfa= -pow(10,-12);
- double beta=0;
- ofstream zapisDoPlikuWynikow("wyniki");
- ofstream zapisDoPlikuDanychWejsciowych("dane");
- while(x0<x)
- {
- y=y0+(h*df(y0,alfa,beta));
- zapisDoPlikuWynikow<<y<<endl;
- zapisDoPlikuDanychWejsciowych<<x0<<endl;
- y0=y;
- x0=x0+h;
- }
- std::cout << "Wynik : "<<y<< std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement