Last active
December 19, 2020 20:56
-
-
Save richardwei6/2ea7b40209d24044e57b0244e9940ff3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
double dydx(double x, double y){ | |
return x+y; | |
} | |
int main(){ | |
double x, y, h, endX; | |
cin >> x >> y >> h >> endX; | |
while (!(abs(x-endX) < 0.001)){ | |
y = y + h*dydx(x,y); | |
x = x + h; | |
cout << x << " " << y << endl; | |
} | |
cout << "ans - " << x << " " << y << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment