Answer to Question #184067 in C++ for Bilal

Question #184067

Comment this code line by line in simple english

AC=(pow((float)(Point2DA[0]-Point2DC[0]),2)+pow((float)(Point2DA[1]-Point2DC[1]),2));
 
        AB=(pow((float)(Point2DA[0]-Point2DB[0]),2)+pow((float)(Point2DA[1]-Point2DB[1]),2));
 
        BC=(pow((float)(Point2DB[0]-Point2DC[0]),2)+pow((float)(Point2DB[1]-Point2DC[1]),2));
 
    }
 
 
    float Area(){
 
        return abs((Point2DA[0]*(Point2DB[1]-Point2DC[1])+Point2DB[0]*(Point2DC[1]-Point2DA[1])+Point2DC[0]*(Point2DA[1]-Point2DB[1]))/2.0);
 
    }
 
 
    bool IsRightAngleTriangle(){
 
        return (((AC == (AB + BC)) || (AB == (AC + BC) ) || (BC == (AC + AB))));
 
    }
 
 
    void Output(){
 
        cout << "The area of triangle: " << Area() << "\n";
 
        if(IsRightAngleTriangle()){
 
            cout << "It is a right angle triangle\n";
 
 
            cout << "The length of Base: " << Base() << "\n";
 
            cout << "The length of Perpendicular: " << Perpendicular() << "\n";
1
Expert's answer
2021-04-24T06:10:35-0400
AC=(pow((float)(Point2DA[0]-Point2DC[0]),2)+pow((float)(Point2DA[1]-Point2DC[1]),2));// calculating the value of AC using pow function
 
        AB=(pow((float)(Point2DA[0]-Point2DB[0]),2)+pow((float)(Point2DA[1]-Point2DB[1]),2));// calculating the value of AB using pow function
 
        BC=(pow((float)(Point2DB[0]-Point2DC[0]),2)+pow((float)(Point2DB[1]-Point2DC[1]),2)); // calculating the value of BC using pow function
 
    }
 
 
    float Area(){ //function definition of area function for area calculation
 
        return abs((Point2DA[0]*(Point2DB[1]-Point2DC[1])+Point2DB[0]*(Point2DC[1]-Point2DA[1])+Point2DC[0]*(Point2DA[1]-Point2DB[1]))/2.0);
 
    }
 
 
    bool IsRightAngleTriangle(){ //function to check whether it is right angled triangle
 
        return (((AC == (AB + BC)) || (AB == (AC + BC) ) || (BC == (AC + AB)))); //condition checking
 
    }
 
 
    void Output(){ //function to give area as output
 
        cout << "The area of triangle: " << Area() << "\n";// giving area as output
 
        if(IsRightAngleTriangle()){// condition checking using if statement
 
            cout << "It is a right angle triangle\n";
 
 
            cout << "The length of Base: " << Base() << "\n";//printing base
 
            cout << "The length of Perpendicular: " << Perpendicular() << "\n"; //printing perpendicular

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS