why is the triangle area showing zero?

When you have a computed value you must compute it with any changes made to the values involved. Unlike algebra where x = y * 2 means “x is by definition y times two”, in C++ it means “assign to x the value of y times 2 as it is right now” and has no bearing on the future.

For something calculated you use a function:

int Area(const int Height, const int Base) {
  return 0.5 * Height * Base;
}

Where now you can call it:

cout<<"Area of the triangle according to your measurements is :"<<Area(Height, Base)<<endl<<endl;    

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top