Question: C++ code Read three sides (S1, S2 and S3) of a triangle from input file Data.txt to check if the triangle is an equal triangle
Read three sides (S1, S2 and S3) of a triangle from input file "Data.txt" to check if the triangle is an equal triangle or not. There will be three cases according sides values: Equal triangle if all sides are equal. Then compute the perimeter (P) and area (A) of triangle. P = S1 + S2 + S3 A = Squareroot (P/2)(P/2 - S1)(P/2 - S2)(P/2 - S3) Not equal triangle if sides are not equal. Then compute the perimeter and area of triangle as shown above. Not triangle if one side or more, is less than or equal zero. Then skip the iteration to read next triangle sides. Write boolean function isEqTri which returns either true if the triangle is equal or false if not. The three sides should be passed by values to the function. Write void function calTri to calculate the area and perimeter of triangle. This function will have five parameters: three sides by values and, area and perimeter by reference. main function should call above functions and use input file to produce an output file as shown below. The program should ask the user for the name of output file. Your solution must: i. Contain all necessary comments (including your ID and name on the top; -5% if not included) ii. Use proper naming style and line indentation iii. The output must be properly aligned as in the sample output (use 2 decimal place for all floating numbers) iv. Submit to Moodle the C++ program (named LT2A_99999.cpp)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
