```/* E01BA_A1W_F C++ Header Example Program.
*
* Copyright 2017 Numerical Algorithms Group.
* Mark 26.2, 2017.
*/

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

int main(void)
{
// Scalars
int               exit_status = 0;
const Integer     m = 7;

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

// Data points and values.
double            xr[m], yr[m];

xr[0] = 0.0;  xr[1] = 0.2; xr[2] = 0.4; xr[3] = 0.6;
xr[4] = 0.75; xr[5] = 0.9; xr[6] = 1.0;

for (int i= 0; i < m; i++) {
yr[i] = exp(xr[i]);
x[i].value = xr[i];
x[i].id = 0;
y[i].value = yr[i];
y[i].id = 0;
}

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

// Register variables to differentiate w.r.t.
for (int i=0; i<m; i++) {
}

const Integer     lck = m + 4, lwrk = 6*m+16;
ifail = 0;

// Evaluate computed spline using e02bb
double            xint_r = 0.5;
xint.value = xint_r;
xint.id = 0;
ifail = 0;

cout << "\n Value of fitted spline at x = " << xint_r;
cout.precision(5);
cout << " is: " << fit.value << endl;

// Setup evaluation of derivatives via adjoints.
double inc = 1.0;

ifail = 0;

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

// Get derivatives
cout << "\n Derivatives of fitted value w.r.t. data points:\n";
cout << "  j    d/dx(j)      d/y(j)\n";
cout.setf(ios::scientific,ios::floatfield);
cout.precision(4);
for (int j=0; j < m; j++) {