Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double f(double x) //function f(x)
- {
- return -2.4*pow(x,2) + 5*x - 3;
- }
- int main()
- {
- double a=-2, b=2, h=0.5, x; //variables
- cout << "x\tf(x)" << endl; //header of table
- for (x=a; x<=b; x+=h) //cycle
- cout << x << "\t" << f(x) << endl;
- getchar(); //pause before closing programm
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement