### cubic spline

i want to test the spline with any three points in x[0]<x<x[n] using function Test(). but the output is confusing me. i dont know how to fix it. please someone help me.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117`` ``````#include #include #define n 9 using namespace std; typedef struct { double x,y; }POINT; class cs { public: cs() {} ~cs() {} void ReadData(POINT [n+1]); void CSpline(); void Display(); void Test(); }; void cs::ReadData(POINT pt[n+1]) { int i; ifstream ifp("Q7.in"); for (i=0; i<=n; i++) ifp>>pt[i].x>>pt[i].y; ifp.close(); //for (i=0; i<=n; i++) //cout<=0; j--) { c[j]=z[j]-mu[j]*c[j+1]; b[j]=(a[j+1]-a[j])/h[j]-h[j]*(c[j+1]+2*c[j])/3; d[j]=(c[j+1]-c[j])/(3*h[j]); } } void cs::Display( ) { //display results } void cs::Test() { cs CS; int i,j; double x; double S[n+1], a[n+1], b[n+1], c[n+1], d[n+1]; POINT pt[n+1]; CS.CSpline(); for (i=0; i<=n; i++) for (j=0; j<=n-1; j++) { x=1.2; S[j]=a[j]+b[j]*(x-pt[j].x)+c[j]*pow((x-pt[j].x),2)+d[j]*pow((x-pt[j].x),3); cout<
Hi lyn18,

So what compiler output do you have?

Some things I noticed:

Your class doesn't have any member variables - only functions.

All your functions are void, most of them don't take arguments, there are no references or pointers, so none of the variables in separate functions are related.

I don't see where the variable n is defined anywhere.

The main function should always return an int:

 ``123456`` ``````int main() { //your code here return 0; //if all is well, some thing else otherwise }``````