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

#include <dco.hpp>
#include <iostream>
#include <nag.h>
#include <stdio.h>
#include <string>
using namespace std;

int main()
{
int exit_status = 0;

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

// Skip heading in data file
string mystr;
getline(cin, mystr);

// Read number of x values
Integer n;
cin >> n;

cout << "    x       df      rlamda     p";
cout << "          p'         df'     rlamda'\n";
cout.setf(ios::scientific, ios::floatfield);
cout.setf(ios::right);
cout.precision(2);

Integer           maxit = 100;
nagad_t1w_w_rtype p, x, df, rlamda, tol;
tol = 0.0;

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

// Loop over x values
for (Integer i = 0; i < n; ++i)
{
// Read next x, df, rlamda
double xr, dfr, rr;
cin >> xr >> dfr >> rr;

x                  = xr;
df                 = dfr;
rlamda             = rr;
double inc         = 1.0;
dco::derivative(x) = inc;
p     = 0.0;
ifail = 0;

// Get derivatives
double dpdx;
dpdx = dco::derivative(p);

x                   = xr;
df                  = dfr;
rlamda              = rr;
dco::derivative(df) = inc;
p     = 0.0;
ifail = 0;
double dpdd;
dpdd = dco::derivative(p);

x                       = xr;
df                      = dfr;
rlamda                  = rr;
dco::derivative(rlamda) = inc;
p     = 0.0;
ifail = 0;
double dpdr;
dpdr = dco::derivative(p);

// Output results
cout.width(9);
cout << dco::value(x);
cout.width(9);
cout << dco::value(df);
cout.width(9);
cout << dco::value(rlamda);
cout.width(9);
cout << dco::value(p);
cout.width(11);
cout << dpdx;
cout.width(11);
cout << dpdd;
cout.width(11);
cout << dpdr << endl;
}

return exit_status;
}
```