Question: These are two parts of one problem. Please write code in C++. Problem 1. Let a,b,c be the lengths of the sides of a triangle.

These are two parts of one problem. Please write code in C++. These are two parts of one problem. Please write code in C++.

Problem 1. Let a,b,c be the lengths of the sides of a triangle. The area is given by: Area=1p(p - a)(p - b)(p-c), where p is half the perimeter, p=(a+b+c)/2. Write a three-file project to calculate the area of a triangle from the coordinates of the 3 points. The project should contain: 1. A header that (a) declare a structure type Triangle that stores the x and y coordinates (in float) of the 3 points that forms a triangle, and (b) prototype a function Area that takes the structure as input and return a float. 2. A source code file for the function Area that takes a structure of Triangle type and returns the area as a float. 3. A source code file contains the main() program that declares a structure of Triangle type, initiate its value, and call function Area to calculate the area. It should also display the coordinates of the 3 points and the area on screen. Problem 2. Use your solution to problem 1. This time, you should create two namespaces. In one namespace, Area is the function that returns a float, in the other Area is an int variable. The program should call function Area to calculate the area of a triangle, and the result should be rounded to an int and stored in the variable Area. The coordinates of the 3 points and the value of int Area should be displayed on screen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!