I need to find the area of the pythagorean triple, it will take x,y,z as sides o
ID: 3624065 • Letter: I
Question
I need to find the area of the pythagorean triple, it will take x,y,z as sides of a triangle and will return an Area. and if the triangle is a right triangle it has to return -9999.99.using the switch command for example the area for the trapezoid
/************************ .h file ********************************/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double WhatsTheArea(double x, double y, double z,char A)
{
int a, b, c;
double s;
switch( A )
{
case 'Z':
return ((x+y)/2)*z;
break;
}
}
/******************** .cpp file *******************************/
#include "stdafx.h
#include "/**** .h file*****/"
int main()
{
cout << " The Area of an Trapezoid = " << WhatsTheArea(4,5,6,'Z');
return 0;
}
Explanation / Answer
/************************ .h file /123.h ********************************/ #include #include #include using namespace std; double WhatsTheArea(double x, double y, double z,char A) { int a, b, c; double s; switch( A ) { case 'Z':{ if(x*x+y*y == z*z) return -9999.99; else return ((x+y)/2)*z; } break; } return 0; } /************************ .h END OF HEADER FILE*****************************/ /******************** .cpp file 123.cpp *******************************/ #include "stdafx.h #include "123.h" int main() { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.