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;
}
//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;
}
Comments
Leave a comment