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

#include <dco.hpp>
#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_T1W_F C++ Header Example Program Results\n\n";

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

// Create AD configuration data object
Integer           ifail = 0;

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

// Call the AD routine once for each active input
ifail = 0;

const Integer &         ndim,
{

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;
};

double inc = 1.0, zero = 0.0;
double dr[3];

for (int i = 0; i < 3; ++i)
{
dco::derivative(ruser[i]) = inc;
work, finval, ifail);
dco::derivative(ruser[i]) = zero;
dr[i]                     = dco::derivative(finval);
}

cout << "\n Derivatives calculated: First order tangents\n";
cout << " Computational mode    : algorithmic\n";

cout.setf(ios::scientific, ios::floatfield);
cout.setf(ios::right);
cout.precision(4);
cout << "\n Solution, x = ";
double ans_value = dco::value(finval);
cout.width(12);
cout << ans_value << endl;
cout << "\n Derivatives:\n";
cout << " d/druser[0] = ";
cout.width(12);
cout << dr[0] << endl;
cout << " d/druser[1] = ";
cout.width(12);
cout << dr[1] << endl;
cout << " d/druser[2] = ";
cout.width(12);
cout << dr[2] << endl;

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