Ok the requirements include a program that asks for three positive number and checks if they are a triangle. I did that ok, but now I have to figure out what kind of triangle that I entered is.
The choices include:
right angle triangle
acute triangle (all three angles < 90 degrees)
obtuse triangle (one of the three angles is greater than 90 degrees),
isosceles triangle (two sides are equal)
equilateral triangle (all three sides are equal)
The program is supposed to work with numbers entered like 3 4 5, 1 1 2, and 1 1 1
Here is what I have but the bottom portion where it checks for what triangle is wrong I know.
#include <iostream>
using namespace std;
int main()
{
double a, b, c;
cout << "Enter 3 positive numbers \n";
cin >> a >> b >> c;
bool isTri = false;
if (a > 0 && b > 0 && c > 0 &&
a + b > c && b + c > a && c + a > B)
{isTri = true;}
if (isTri && c==sqrt(a*a + b*b) || a==sqrt(b*b + c*c) || b==sqrt(a*a + c*c))
{cout<<"This is a right angle triangle\n";}
if(isTri && a<90 && b<90 && c<90 && a!=b!=c)
{cout<<"\nThis is an acute triangle\n";}
if (isTri && a>90 || b>90 || c>90)
{cout<<"\nThis is an obtuse angle\n";}
if (isTri && a==b || b==c || a==c)
{cout<<"\nThis is an isosceles triangle\n";}
if (isTri && a==b==c)
{cout<<"\nThis is an equilateral triangle\n";}
else
{cout << "The three nubmers "<<a<<", "<<b<<" and "<<c<<" do not form a triangle\n";}
return 0;
}
Thanks.