CPPForSchool.com: Library Function Set 1: Assignment 2
2.
Write a program to compute area of triangle. Sides are input by user.
Area = sqrt(s*(s-a)*(s-b)*(s-c))
where s=(a+b+c)/2.
Perhaps it is the fact that the formulas have been provided, but this assignment was very easy going for me. Honestly, it was quite fun for once. Nevertheless, for this assignment, it was pretty straight forward. I declared the values using float instead of int because the user should have the ability to input decimal based values. Not surprisingly, my code appears to be a clone of the sample source. Luckily for me, I do not review the sample code unless I feel as if I am truly unable to complete the assignment. Below is my source code and output. Also, I have included the sample source and output for comparison.
Area = sqrt(s*(s-a)*(s-b)*(s-c))
where s=(a+b+c)/2.
Perhaps it is the fact that the formulas have been provided, but this assignment was very easy going for me. Honestly, it was quite fun for once. Nevertheless, for this assignment, it was pretty straight forward. I declared the values using float instead of int because the user should have the ability to input decimal based values. Not surprisingly, my code appears to be a clone of the sample source. Luckily for me, I do not review the sample code unless I feel as if I am truly unable to complete the assignment. Below is my source code and output. Also, I have included the sample source and output for comparison.
Comments
Post a Comment