Question: Now write a new class called Triangle. A triangle consists of 3 points. The Triangle class should have one default constructor and another constructor that
Now write a new class called Triangle. A triangle consists of 3 points. The Triangle class should have one default constructor and another constructor that initialises the three points of the triangle. It should also have a member function that calculates the area of the triangle according to the formula:
Area = sqrt(s*(s-a)*(s-b)*(s-c))
where a, b and c are the lengths of the three sides, and s is half of the sum of the three sides. Write a main function that inputs three points from the user, and prints out the area of the triangle they form.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
