#include <iostream>
using namespace std;

double *dodaj(int a, int b)
{
    double *c = new double;
    *c = a + b;
    return c;
}
double *odejmij(int a, int b)
{
    double *c = new double;
    *c = a - b;
    return c;
}
double *pomnoz(int a, int b)
{
    double *c = new double;
    *c = a * b;
    return c;
}
double *podziel(int a, int b)
{
    double *c = new double;
    if (b != 0)
        *c = (double)a / b;
    else
        *c = 0;
    return c;
}

int main()
{
	double *(*g)(int, int);
	g = dodaj;
	cout << *g(2, 4) << endl;
	g = odejmij;
	cout << *g(2, 4) << endl;
	g = pomnoz;
	cout << *g(2, 4) << endl;
	g = podziel;
	cout << *g(2, 4) << endl;
	
	return 0;
}