Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need help with this questions in c++ Write a program called all_area semi.cpp that computes the area of an arbitrary triangle. Use the following
i need help with this questions in c++
Write a program called "all_area semi.cpp" that computes the area of an arbitrary triangle. Use the following formula: area - ys(s -a) (s - b)(s - c) where a, b and c are the lengths of the sides, and s is the semiperimeter s- (a b+c)/2 Include a void function call "Compute" that computes the area and perimeter of a triangle based on the length of the sides. The function should use five parameters three call by value parameters (a, b, c) that provide the lengths of the edges and two call by reference parameters (area, semiperimeter) that stores the computed area and perimeter. Make your function robust. The function "Compute" should be called from your main program. Your must print the computed area and semiperimeter rounded to the nearest hundredths. In main you should declared the necessary variables, and include a while loop asking the user if he/she would like to continue computing area and semiperimeters Note that not all combinations of a, b, and c produce a triangle. Remember, the sum of any two sides of a triangle must be greater than the third side. You must make sure that the lengths of the sides of the triangle entered by the user are valid; if not valid lengths, you should let the user know by printing a message stating that the lengths are invalid, and then prompt the user if he/she would like to continue computing area and semiperimeters. Your function should produce correct results for legal data and reasonable results for illegal combinations You may implement more functions if you find it necessary. Please start the assignment ASAP and ask questions to make sure you understand what you must do. Remember to follow all style rules and to include all necessary documentation (consistent, indentation, proper variable names, pre/post condition, program header, function headers, and so forth.) Electronically submit the source file "all_area_semi.cpp " in the Assignments area of blackboard before the due date and time. Remember, submit your assignment on time no matter if it is incomplete and/or incorrect. Consider the following skeleton as a hint: /include necessary libraries using namespace std; /include function prototypes /void Compute(format parameters go here) int main( //declare variables a, b, c,area, and semiperimeter //declare variable for while loop //while loop //begin while loop //call Computer /lend while loop return 0 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started