NAG Library Manual, Mark 28.4
```/* D01FC_P0W_F C++ Header Example Program.
*
* Copyright 2022 Numerical Algorithms Group.
* Mark 28.4, 2022.
*/

#include <iostream>
#include <math.h>
#include <nag.h>
#include <stdio.h>
using namespace std;

int main()
{
// Scalars
int     exit_status = 0;
Integer ndim = 4, maxpts = 4000, lenwrk = 100;

cout << "D01FC_P0W_F C++ Header Example Program Results\n\n";

// Allocate memory
double *a = 0, *b = 0, *work = 0;

a    = new double[ndim];
b    = new double[ndim];
work = new double[lenwrk];

// Initialize variables
for (int i = 0; i < ndim; i++)
{
a[i] = 0.0;
b[i] = 1.0;
}
Integer minpts = 0;
double  eps    = 0.0001;
double  ruser[3];
ruser[0] = 4.0;
ruser[1] = 2.0;
ruser[2] = 1.0;

// Call the passive routine
Integer           ifail = 0;
double            finval, acc;

const Integer &         ndim,
const double *z,
double &     fz)
{
double f1, f2, f3;

f1 = ruser[0] * z[0] * z[2] * z[2];
f2 = ruser[1] * z[0] * z[2];
f2 = exp(f2);
f3 = ruser[2] + z[1] + z[3];
f3 = f3 * f3;
fz = f1 * f2 / f3;
};

work, finval, ifail);

cout.setf(ios::scientific, ios::floatfield);
cout.setf(ios::right);
cout.precision(4);
cout << "\n Solution, x = ";
cout.width(12);
cout << finval << endl;

delete[] a;
delete[] b;
delete[] work;
return exit_status;
}
```