#include<cstdlib> #include<iostream> using namespace std; typedef double (*wskFun) (double x); double f(double x) { return x*x; } int main(int argc, char *argv[]) { wskFun g; g = f; cout << g(2.) << endl; system("pause"); return 0; };
#include<cstdlib> #include<iostream> #include<cmath> using namespace std; double funF(double x) { return x * sin(x); } double funG(double x) { return x*x; } void Tablicuj( double (*f) (double x), double a, double b, int n) { double h = ( b - a) / n, x; for (int i=0; i<=n; ++i) { x = a + i * h; cout << x << " " << f(x) << endl; } } int main(int argc, char *argv[]) { Tablicuj(funG, 0, 4, 20); Tablicuj(funF, 0, 4, 20); system("pause"); return 0; };