Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- double f(double x){
- return x + 4 / (x + 0.3) - sin(x) - 3;
- }
- double max1(double a, double b, double h){
- ifstream input("output.txt");
- double x = a;
- double m;
- while (x <= b){
- double b;
- input >> b;
- if (x == a){
- input >> m;
- }else{
- double val;
- input >> val;
- if (val > m){
- m = val;
- }
- }
- x += h;
- }
- return m;
- }
- int main()
- {
- double a, b, h;
- cin >> a >> b >> h;
- ofstream output("output.txt");
- double x = a;
- while ( x <= b){
- output << x << " " << f(x) << endl;
- x += h;
- }
- cout << max1(a, b, h);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement