So I have been working at this for awhile and I don't understand the div part. I understand that add sub and mul return 6 21 and -10 but cannot figure out how div returns 12.5 Could someone break this down a bit more and help me understand? Thank you
#include <iostream>
#include <iomanip>
using namespace std;
double add (double x,double y) {return x + y;}
double sub (double x,double y) {return x - y;}
double mul (double x,double y) {return x * y;}
double div (double x,double y) {return x / y;}
double F (double(*p)(double, double), int n)
{
double u = 5.0, v = -2.0;
return n * p (u,v);
}
int main()
{
cout << F (add,2) << endl;
cout << F (sub,3) << endl;
cout << F (mul,1) << endl;
cout << F (div,-5) << endl;
return 0;
}