I need help with the following code that requires me to:
Declare 3
doubletype variables, each representing one of three sides of a triangle.Prompt the user to input a value for the first side, then
Set the user’s input to the variable you created representing the first side of the triangle.
Repeat the last 2 steps twice more, once for each of the remaining 2 sides of the triangle.
Use a series of nested
if/elsestatements to determine if the triangle having side-lengths as set by the user is an EQUILATERAL, ISOSCELES, or SCALENE triangle. [Note: look to the Wikipedia page on ‘triangle’ for definitions of these three types of triangles.]Print the resulting triangle type to the console.
Ensure your Triangle detector works by running it 5 times as in the example above. You may use the same values as in the example.
I currently have:
//lab eleven program code on triangles #include <iostream.h> main() { //variables float aside, bside, cside; //enter side a cout<<"enter the length of side a "<<endl; cin>>aside; //enter side b cout<<"enter the length of side b "<<endl; cin>>bside; //enter side c cout<<"enter the length of side c "<<endl; cin>>cside; // all sides equal if(aside==bside && bside==cside) cout << "Equilateral triangle\n"; // at least 2 sides equal else if(aside==bside || aside==cside || bside==cside) cout << "Isosceles triangle\n"; // no sides equal else cout << "Scalene triangle\n"; } But I need help with the if and else if statements to determine the type triangle. Our professor has not covered this topic in class.
We use the program Ch 6.3 on Windows.
LOL!