90 161
Assignments Done
99.5%
Successfully Done
In September 2020

# Answer to Question #48784 in C++ for ama nae

Question #48784
Given the lengths a,b,c of the sides of triangle, write a function based program to compute the area of the triangle., The formula for computing the area is given by:
where s is the semiparameter of the triangle
s=(a+b+c)/2

2. Convert the program to calculate the area and circumference of the circle into function by reference code.
1
2014-11-12T00:38:23-0500
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
using namespace std;
float CalculateAreaTriangle(float a, float b, float c)
{
float s;
float area;
s = (a+b+c)/ 2.0;
area = sqrt( s * (s-a) *(s-b) *(s-c) );
return area;
}
void CalculateAreaCircumference(float radius, float &area, float &circumReference)
{

circumReference = 2 * 3.14 * radius;
}
int main()
{
do
{
do
{
system("cls");
cout<<"What you want to compute : "<<endl;
cout<<"1. Compute the area of the triangle"<<endl;
cout<<"2. Calculate the area and circumference of the circle"<<endl;
cout<<"3. Exit"<<endl;
{
case 1:
{
float a, b, c;

system("cls");
cout<<"Enter the lengths a,b,c of the sides of triangle ";
cin>>a>>b>>c;
cout<<"Area of the triangle : "<<CalculateAreaTriangle(a,b,c)<<endl;
system("pause");
} break;

case 2:
{
system("cls");
cout<<"Enter the radius of the circle ";
cout<<"Area of the circle : "<<area<<endl;
cout<<"Circumference of the circle : "<<circumReference<<endl;
system("pause");

} break;
case 3: break;
}
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!