undeclared(first use this function)

closed account (zT7X92yv)
I am new to c++ and I am a stupid nub...

I can't figure out why my...

deta=(aei+bfg+cdh)-(gec+hfa+idb); is undeclared

What lib do I use? and I am supposed ot have my x,y,z answers on a notepad or word doc. how do I do that?

thank you!

here is my code: !




#include <iostream>
#include <iomanip>


using namespace std;
int main()
{
int a,b,c,d,e,f,k,l,g,h,i,j;
double x,y,z;
double deta,detx,dety,detz;



cout << "enter three coefficients of the 1st linear equation,\nin the form ax + by+cz = j\n";
cin >>a>>b>>c>>j;


cout << "\nenter three coefficients of the 2st linear equation,\nin the form dx + ey +fz = k\n";
cin >>d>>e>>f>>k;

cout << "\nenter three coefficients of the 3rd linear equation,\nin the form gx + hy +iz = l\n";
cin >>g>>h>>i>>l;

cout << endl;
cout << "\nthe 1st linear equation is: " << a << "x + " << b << "y + " << c << "z =\t" << j << endl;
cout << "the 2nd linear equation is: " << d << "x + " << e << "y + " << f << "z =\t" << k << endl;
cout << "the 3rd linear equation is: " << g << "x + " << h << "y + " << i << "z =\t" << l << endl;


deta=(aei+bfg+cdh)-(gec+hfa+idb);
detx=(jei+bfl+ckh)-(lec+hfj+ikb);
dety=(akl+jfg+cdl)-(gkc+lfa+idj);
detz=(ael+bkg+jdh)-(gej+hka+ldb);

x=detx/deta;
y=dety/deta;
z=detz/deta;

cout << "\nx is:" << x << endl << "y is:" << y << "z is:" << z << endl<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}


Last edited on
If you want to mulitply variables, you must use the * character. For example, a*e*i instead of aei; in the second case the compiler is looking for a variable named "aei" and it isn't finding one.
closed account (zT7X92yv)
wow Thank You very much!

you're a lifesaver!
Topic archived. No new replies allowed.