Example description
/* E01AA_P0W_F C++ Header Example Program.
 *
 * Copyright 2019 Numerical Algorithms Group.
 * Mark 27, 2019.
 */

// #define USE_DCO

#include "dco_light.hpp"

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

int main(void)
{
  // Scalars
  int               exit_status = 0;

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

  // Skip first line of data file
  string mystr;
  getline (cin, mystr);
  // Read number of data points
  Integer n;
  cin >> n;

  // Allocate arrays for data and interpolant
  double  x,  *a = 0, *b = 0, *c = 0;
  Integer n1, n2;
  n1 = n + 1;
  n2 = n*(n+1)/2;
  a = new double [n1];
  b = new double [n1];
  c = new double [n2];

  cin >> x;

  for (int i= 0; i < n1; i++) {
    cin >> a[i];
  }
  for (int i= 0; i < n1; i++) {
    cin >> b[i];
  }
  
  // Call the passive routine
  Integer ifail = 0;
  void    *ad_handle = 0;
  e01aa_p0w_f_(ad_handle,a,b,c,n,x,ifail);
      
  cout.setf(ios::scientific,ios::floatfield);
  cout.precision(5);
  cout << "\n Interpolation point = ";
  cout.width(12);cout << x << endl;
  cout << "\n Function value at interpolation point = ";
  cout.width(12);cout << c[n2-1] << endl;

  delete [] a;
  delete [] b;
  delete [] c;
  return exit_status;
}