hi, i want 2 calculate the angle pettween 3 potential sides by this formula
fabs( (slope2-slope1)/(1 + slope11*slope2)) ;
so , what i want is the angle .that's why i must use the tan inverse
i found in my book that tan inverse is written as (tanh(x)
but the answer would'nt show what to do .
her is my program the question ask to read 3 points from a file
and then determain wither these 3 points form atringle if yes calculat the area and the primeter :
# include <iostream>
# include <fstream>
# include <cmath>
# include <iomanip>
# include <string>
using namespace std;
int main()
{
// decalaring the variables that we will read from file
float X1,X2,X3;
float Y1,Y2,Y3;
string fileName;
fstream inData; //decalaring apointer
// prompt the user to enter file name wich contain the apropreuat format
cout << "please enter the name of the file cotaning the 3 coordinates\n the file should have the following format :(X1,Y1);(X2,Y2);(X3,Y3):";
cin >> fileName;
//opining the file
inData.open(fileName.c_str());
// shecking if the file existes
if (! inData) {
cout << "Error:cannot open file " << fileName << endl;
}
cout << "Absolute value of the angle between side1 and side2 is: " << setprecision(2) << angle1 << endl;
cout << "Absolute value of the angle between side3 and side1 is: " << setprecision(2) << angle2 << endl;
cout << "Absolute value of the angle between side3 and side2 is: " << setprecision(2) << angle3 << endl;
// if all the information shows atringle then we will calculate the the area and the primeter
// if not we will disblay a masseag tell that the following points dose not represent a tringle
double sum_angle ;
sum_angle = angle1 + angle2 + angle3;
if (( sum_angle == 180) && ( (slope1 != slope2) && (slope2 != slope3) && (slope1 != slope3)))
{
cout << "The three points form a triangle that has" << endl;
double A,P; // declaring the area AND the perimeter
// showing the area and the perimeter in the out put
cout << "an area of : " << A << endl;
cout << "and a perimeter of : " << P << endl;
}
else
{
cout << "The three points do not form a triangle!!" << endl;
}
inData.close();