Answer to Question #184073 in C++ for Bilal

Question #184073

Comment this code line by line in simple english

float Height(){
 
        return sqrt(pow((float)(points2D[0]-points2D[2]),2)+pow((float)(points2D[1]-points2D[3]),2));
 
    }
 
 
    float Perimeter(){
 
        return 2*(Length()+Height());
 
    }
 
 
    float Diagonal(){
 
        return sqrt(pow((float)(points2D[0]-points2D[4]),2)+pow((float)(points2D[1]-points2D[5]),2));
 
    }
 
};
 
 
 
int main (){
 
    Rectangle rectangle;
 
    rectangle.Input();
 
    rectangle.Output();
 
 
 
    system("pause");
 
    return 0;
 
}
 
1
Expert's answer
2021-04-26T02:32:26-0400
//Declaring Height with type float//
float  Height(){
       
        return sqrt(pow((float)(points2D[0]-points2D[2]),2)+pow((float)(points2D[1]-points2D[3]),2));
 
    }
 //Return the height square which is inserting as the second element of the 2D array
 
//Declaring Perimeter with type float//
    float Perimeter(){
 
        return 2*(Length()+Height());
 
    }
//Return the perimeter of the rectangle
 
 //Declaring Digonal with type float//
    float Diagonal(){
 
        return sqrt(pow((float)(points2D[0]-points2D[4]),2)+pow((float)(points2D[1]-points2D[5]),2));
 
    }
 
};
//return the length of the digonal of rectangle

 
 
 //driver function
int main (){
 //Initializing a rectangle 
    Rectangle rectangle;
 //Take the input of the rectangle
    rectangle.Input();
 //Process the output of rectangle
    rectangle.Output();
 //stop the processing
    system("pause");
 
    return 0;
 
}
 

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