Respuesta :
The program is an illustration of C++ functions;
Functions are program statements that are executed when evoked
The C++ program
The program in C++, where comments are used to explain each action is as follows:
#include <iostream>
#include <cmath>
using namespace std;
//This defines the boolean method
bool isoscelesTriangleHeightAndArea(double base, double hypotenuse, double height, double area) {
//This checks for invalid base and height
if(base < 0 || hypotenuse < 0){
return false;
}
//This returns true if base and height are valid
return true;
}
//The main begins here
int main(){
//This initializes the variables
double base, hypotenuse, height, area;
//This gets input for base and hypotenuse
cout<<"Base: "; cin>>base;
cout<<"Hypotenuse: "; cin>>hypotenuse;
//The calls the boolean method
bool success = isoscelesTriangleHeightAndArea(base, hypotenuse, height, area);
//If success is True
while (success){
//This calculates height
height = sqrt(hypotenuse*hypotenuse - (base/2) * (base/2));
//This calculates area
area = 0.5 * base * height;
//This prints height
cout << "Triangle height is " << height << endl;
//This prints area
cout << "Triangle area is " << area << endl;
//This gets input for base and hypotenuse
cout<<"Base: "; cin>>base;
cout<<"Hypotenuse: "; cin>>hypotenuse;
bool success = isoscelesTriangleHeightAndArea(base, hypotenuse, height, area);
}
cout << "Invalid Input!" << endl;
}
Read more about C++ programs at:
https://brainly.com/question/24833629
#SPJ1