I attempted to write a C++ program to determine whether a triangle is a right tr
ID: 1798689 • Letter: I
Question
I attempted to write a C++ program to determine whether a triangle is a right triangle or not. However, my compiler is having a problem with lines 14, 19, 21, 23, and 25. here si my program:#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
int boolean;
int num1, num2, num3;
int s1,s2,s3;
boolean; right=false;
s1=num1*num1;
s2=num2*num2;
s3=num3*num3;
if((s1+s2) == s3)
right=true;
else if((s1+s3) == s2)
right=true;
else if ((s2+s3) == s1)
right=true;
else
right=false;
return(0);
}
I would greatly appreciate it if someone could clarify for me where I am making my error. Thanks, in advance, for any assistance.....
Explanation / Answer
#include #include #include #include using namespace std; int main() { int boolean; int num1, num2, num3; int s1,s2,s3; char right[]="false"; s1=num1*num1; s2=num2*num2; s3=num3*num3; if((s1+s2) == s3) right="true"; else if((s1+s3) == s2) right="true"; else if ((s2+s3) == s1) right="true"; else right="false"; return(0); }Related 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.