my program compiles and executes fine but when i try to run it, it goes through a little bit then errors. here is my code
thanx
Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int xa;
int ya;
int xb;
int yb;
int xc;
int yc;
int sa;
int cx;
int cy;
int oa;
int boa;
int sb;
int ob;
int bob;
int oc;
int od;
int ox;
int oy;
int mxa;
int mya;
int mxb;
int myb;
int ca;
int cb;
int cc;
int cd;
int ce;
int cf;
int cix;
int ciy;
int sc;
int sd;
int ea;
int eb;
int ec;
int ed;
int ee;
int ef;
int ex;
int ey;
cout << "enter the x position of the first coordinate: ";
cin >> xa;
cout << "enter the y position of the first coordinate: ";
cin >> ya;
cout << "enter the x position of the second coordinate: ";
cin >> xb;
cout << "enter the y position of the second coordinate: ";
cin >> yb;
cout << "enter the x position of the third coordinate: ";
cin >> xc;
cout << "enter the y position of the third coordinate: ";
cin >> yc;
cx = (xa + xb + xc) / 3;
cy = (ya + yb + yc) / 3;
cout << "The centroid is (" << cx << "," << cy << ")" << endl;
sa = (yb - ya) / (xb - xa);
oa = xc * -sa;
boa = yc - oa;
sb = (yc - ya) / (xc - xa);
ob = xb * -sb;
bob = yb - ob;
oc = oa - ob;
od = bob - boa;
ox = oc / od;
oy = (oa * ox) + boa;
cout << "The orthocenter is (" << ox << "," << oy << ")" << endl;
mxa = (xa + xb) / 2;
mya = (ya + yb) / 2;
mxb = (xa + xc) /2;
myb = (ya + yc) / 2;
cb = mxa * -sa;
ca = mya - cb;
cc = mxb * -sb;
cd = myb - cc;
ce = cb - cc;
cf = cd - ca;
cix = cf / ce;
ciy = (cb * cix) + ca;
cout << "The circumcenter is (" << cix << "," << ciy << ")" << endl;
sc = (cx - cix) / (cy - ciy);
sd = (cx - ox) / (cy - oy);
ea = cx * sc;
eb = cx * sd;
ec = cy - ea;
ed = cy - eb;
ee = ea - eb;
ef = ed - ec;
ex = ef / ee;
ey = (ea * ex) + ec;
cout << "\n\nThe Euler Line for this Triangle is (" << ex << "," << ey << ")" << endl;
system("PAUSE");
return 0;
}