Okay, I've run into some problems
Dug out my old math texts to do this... oddly enough though I've remembered them all...And it spits out like 51 erros. What's wrong? Do classes have to be in header files or something?PHP Code:// Lines.cpp
#include <iostream>
using namespace std;
class nline {
double l_m;
double l_b;
public:
nline(double x1, double y1, double x2, double y2); // 2x Points
nline(double x, double y, double m); // Point/Slope
nline(double m, double b); // y = mx + b
nline(int a, int b, int c); // Ax + By + C = 0
~nline();
double slope();
double yint();
};
nline::nline(double x1, double y1, double x2, double y2) {
l_m = (y2 - y1) / (x2 - x1);
l_b = y1 - (x1 * l_m);
}
nline::nline(double x, double y, double m); {
l_m = m;
l_b = y - (x * l_m);
}
nline::nline(double m, double b) {
l_m = m;
l_b = b;
}
nline::nline(int a, int b, int c) {
l_m = -a / b;
l_b = c / b;
}
nline::~nline() {
l_m = 0;
l_b = 0;
}
double nline::slope() {
return l_m;
}
double nline::yint() {
return l_b;
}
int main() {
nline line1(8, -2, 5, 7);
cout << line1.slope << endl;
cout << line1.yint << endl;
return 0;
}
// EOF





Reply With Quote