displaying problem

This is a discussion on displaying problem within the C++ Programming forums, part of the General Programming Boards category; Hi,
I have the following problem ( triangle of sides a,b,c)
Write a void function that uses five parameters: 3 ...

displaying problem

Hi,
I have the following problem ( triangle of sides a,b,c)

Write a void function that uses five parameters: 3 values are the length of the edges of the triangle, and 2 are reference parameter that compute the area and perimeter.
Make the function robust.
Note that not all combination of a,b,c produce a triangle.
the function should produce correct results for legal data and reasonable results for illegal combination.

This is what I wrote below.
The problem I have is that when I enter bad combination for the edges of the triangles, instead of just displaying "bad combination, it continues and compute the area and perimeter (even though the data are illegal.

That's probably not allowed. The only other way I can think of is a global variable to flag errors. It's a bad option though. I only mention it because it seems like your teacher is forcing that kind of error handling method.