Was compiling homework problem with Dev-C++ and got
]Linker Error] undefined reference to determinant(float, float, float, float, float, float, float, float, float)
Anyone know what this is?
#include <iostream>
using namespace std;
float determinant(float, float, float, float, float, float, float, float, float);
int main()
{
float x1, x2, x3, y1, y2, y3, z1, z2, z3, c1, c2, c3; //unknowns
float dx, dy, dz, d; //determinants
float x, y, z; //results
cout << "This program will solve a system of equations with three variables." << endl;
cout << "Please enter the system one at a time and in order like so: x y z c" << endl;
cout << "x y z c" << endl;
cin >> x1 >> y1 >> z1 >> c1;
cin >> x2 >> y2 >> z2 >> c2;
cin >> x3 >> y3 >> z3 >> c3;
cout << "Are these correct? :";
char response;
cin >> response;
if (response=='n')
return 0;
else
{
cout << "Dx = ";
dx=determinant(c1, c2, c3, y1, y2, y3, z1, z2, z3);
cout << endl << "Dy = ";
dy=determinant(x1, x2, x3, c1, c2, c3, z1, z2, z3);
cout << endl << "Dz = ";
dz=determinant(x1, x2, x3, y1, y2, y3, c1, c2, c3);
cout << endl << "D = ";
d=determinant(x1, x2, x3, y1, y2, y3, z1, z2, z3);
x=dx/d;
y=dy/d;
z=dz/d;
cout << "X = " << x << " Y = " << y << " Z = " << z;
cin.get();
cin.get();
return 0;
}
}
float determinant(float x1,float x2,float x3,
float y1,float y2,float y3,
float z1,float z2,float z3,
float c1,float c2,float c3)
{
float determinantval= x1*(y2*z3-y3*z2)
- x2*(y1*z3-y3*z1)
+ x3*(y1*z2-y2*z1);
cout << determinantval;
return determinantval;
}