| 6 | using namespace std; |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | cout << "\t\tC++ program to Calculate Area of Scalene Triangle.\n"; |
| 11 | float a, b, c, S, Area; |
| 12 | cout << "Please enter the values for the first side of Triangle: "; |
| 13 | cin >> a; |
| 14 | cout << "Please enter the values for the second side of Triangle: "; |
| 15 | cin >> b; |
| 16 | cout << "Please enter the values for the third side of Triangle: "; |
| 17 | cin >> c; |
| 18 | |
| 19 | if (a > 0 && b > 0 && c > 0) { |
| 20 | if (c < a + b && a < b + c && b < a + c) { |
| 21 | S = (a + b + c) / 2; |
| 22 | Area = sqrt(S * (S - a) * (S - b) * (S - c)); |
| 23 | cout << "The Area of Triangle is " << Area << endl; |
| 24 | return 0; |
| 25 | } |
| 26 | else { |
| 27 | cout << "This triangle is wrong try another values." << endl; |
| 28 | return 0; |
| 29 | } |
| 30 | } |
| 31 | else { |
| 32 | cout << "The sides of Triangle cannot be negative numbers!" << endl; |
| 33 | } |
| 34 | |
| 35 | system("pause"); |
| 36 | return 0; |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected