Page 1 CPSC1103 LAB WEEK 10 1. Write a C++ program to do the following: The area
ID: 3680994 • Letter: P
Question
Page 1
CPSC1103 LAB WEEK 10
1. Write a C++ program to do the following:
The area of an arbitrary triangle can be computed using the formula
area = sqrt(s(s-a)(s-b)(s-c))
where a, b, and c are lengths of the sides, and s is the semiperimeter.
S = (a + b + c)/2
Write a void function that uses five parameters: three value parameters that
provide the lengths of the edges, and computes the area and perimeter (not the
semiperimeter) via reference parameters. Make your function robust. Note that
not all combinations of a, b, and c produce a triangle. Your function should
produce correct results for legal data and reasonable results for illegal
combinations.
Use two value-return functions to perform the above. Use one to compute the
area and one to compute the perimeter.
Explanation / Answer
Any help please comment
#include <iostream>
using namespace std;
int ssss (int a, int b,int c)
{
int s;
s=(a+b+c)/2;
cout <<"Enter the a=" << endl;
cin >> a;
cout <<"Enter the b=" << endl;
cin >> b;
cout <<"Enter the c = " << endl;
cin >> c;
return (s);
}
int main ()
{
double area;
area = sqrt(s*(s-a)*(s-b)*(s-c));
cout << "The result _area " << araa;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.