This is what the program is supposed to do:
2.36: You must test for all the possible orientations of the input values as possible sides.
For example, if x, y, z are the input variables and
in an imaginary tryiangle a is the height, b the base, and c the hypotenuese, then you must check for
x = a b c
y = b c a
z = c a b
This is what I have for the core of the program:
{
int a, b, c, a2, b2, c2;
cout<<"Enter three numbers to see if they are the sides of a right triangle: \n";
cout<<"\n";
cin>>a2;
cin>>b2;
cin>>c2;
if (c2=sqrt((a2*a2)+(b2*b2)))
{
cout<<"These numbers CAN form a right triangle";
}
else if (b2=sqrt((a2*a2)+(c2*c2)))
{
cout<<"These numbers CAN form a right triangle";
}
else if (a2=sqrt((c2*c2)+(b2*b2)))
{
cout<<"The number CAN form a right triangle\n\n";
}
else
{
cout<<"The numbers CANNOT for a right triangle";
}
return (0);
}
How do I take the square root of something, thats the problem. see any others?
2.36: You must test for all the possible orientations of the input values as possible sides.
For example, if x, y, z are the input variables and
in an imaginary tryiangle a is the height, b the base, and c the hypotenuese, then you must check for
x = a b c
y = b c a
z = c a b
This is what I have for the core of the program:
{
int a, b, c, a2, b2, c2;
cout<<"Enter three numbers to see if they are the sides of a right triangle: \n";
cout<<"\n";
cin>>a2;
cin>>b2;
cin>>c2;
if (c2=sqrt((a2*a2)+(b2*b2)))
{
cout<<"These numbers CAN form a right triangle";
}
else if (b2=sqrt((a2*a2)+(c2*c2)))
{
cout<<"These numbers CAN form a right triangle";
}
else if (a2=sqrt((c2*c2)+(b2*b2)))
{
cout<<"The number CAN form a right triangle\n\n";
}
else
{
cout<<"The numbers CANNOT for a right triangle";
}
return (0);
}
How do I take the square root of something, thats the problem. see any others?
