I'm still getting errors when I try to compile. Here is my entire code for the class as it stands right now:

Code:

#include <iostream>
using namespace std;
class PolyLine {
double *x;
double *y;
int length;
public:
PolyLine (double xVals[], double yVals[], int num) {
length = num;
x = new double[length];
y = new double[length];
for (int i = 0; i < length; i++) {
x[i] = xVals[i];
y[i] = yVals[i];
}
}
int points() {
return length;
}
double value(double xNum) {
double val = 0.0;
double finalSpot = x[length - 1];
if (xNum < x[0] || xNum > finalSpot) return val;
for (int i = 0; i < length; i++) {
if (x[i] == xNum) val = y[i];
else if (x[i] != xNum && x[i] > xNum) val = xNum;
}
return val;
}
double max() {
double max = 0.0;
for (int i = 0; i < length; i++)
if (y[i] > max) max = y[i];
return max;
}
double max(double a, double b) {
double max = 0.0;
double finalSpot = x[length - 1];
int i = 0;
while (x[i] != a) {
if (i == length - 1) return max;
else if (x[i] > a) {
if (y[i] < 0) break;
else {
max = y[i];
break;
}
}
else i++;
}
while (x[i] != b) {
if (i == length - 1 || x[i] > finalSpot || b < x[i]) return max;
else if (y[i] > max) max = y[i];
i++;
}
return max;
}
double integral(double a, double b) {
double integ = 0.0;
double trapFormula = 0.0;
int i = 0;
int num = 0;
while (x[i] != a) {
if (i == length - 1) return integ;
else i++;
}
while (x[i] != b && i != length - 1) {
trapFormula = ((x[i+1] - x[i]))*((y[i]+y[i+1])/2);
integ += trapFormula;
i++;
}
return integ;
}
ostream output(ostream &out) {
int finalSpot = length - 1;
for (int i = 0; i < finalSpot; i++)
out << "(" << x[i] << "," << y[i] << "):";
out << "(" << x[finalSpot] << "," << y[finalSpot] << ")" << endl;
return out;
}
ostream & operator << (ostream & out, const PolyLine ob) {
return ob.output(out);
}
};

Can you tell me what I'm doing wrong now? Thanks.