C/C++ Calculating Triangle Area Using C++ Programming

Click For Summary
The discussion revolves around a programming project in C++ that requires calculating the area of a triangle based on three user-provided side lengths. The main focus is on using Heron's formula for area calculation and ensuring the validity of the triangle using the triangle inequality theorem. Participants emphasize the importance of checking if the sum of the two smaller sides is greater than the largest side to confirm that a valid triangle can be formed. Several coding issues are addressed, including the correct implementation of Heron's formula, variable declaration, and the need to compute the area only if the radicand (r) is positive. The conversation also touches on debugging, with suggestions to handle error messages and ensure the program does not close unexpectedly. Ultimately, the user learns to implement conditional statements effectively and understands the necessity of fulfilling both the area calculation and triangle validity conditions as part of the assignment requirements.
  • #61
ineedhelpnow said:
he wants us to fulfill the second condition because he wants us to be able to code it properly. to have us use all the different types of commands and functions.

You are fulfilling the triangle inequality, with one statement, but you know your professor better than I do, so do what you think is best. :D
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
1
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
5
Views
3K
Replies
2
Views
3K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
7K
  • · Replies 9 ·
Replies
9
Views
2K