Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SUBJECT: PROGRAMMING FOR ENGINEER LANGUAGE: C++ (USING FUNCTION) ANSWER WITH DETAIL, TRUE AND PERFECT Coding Question: Triangle Construction (20 Marks) A text file, length.txt has
SUBJECT: PROGRAMMING FOR ENGINEER
LANGUAGE: C++ (USING FUNCTION)
ANSWER WITH DETAIL, TRUE AND PERFECT
Coding Question: Triangle Construction (20 Marks) A text file, length.txt has the following information: length.txt 3 4 2 0 4 4 8 5 5 1 6 0 In a triangle, the sum of any two sided is always greater than the third side. Write a program that read the length of three lines from length.txt file. It then determines whether the three lines can be used to construct a triangle or not. If a triangle can be constructed, compute the area of the triangle. Note that the area of triangle can be calculated using the following formula, where a, b and c are the length of the sides; and s is calculated as follow Your program should perform all the following tasks: Check the existence of length.txt file Use loop to read the lengths from length.txt file and display the value Determine whether a triangle is possible or not If possible, calculate the area using calc_area() function (programmer-defined function) Display the area of triangle in main(). Set the display output to four decimal places of precisionStep 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