Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> using namespace std; //enumeration type enum triangleType {n

ID: 3620937 • Letter: #

Question

#include <iostream>
using namespace std;

//enumeration type
enum triangleType {noTriangle, equilateral, isosceles,scalene};

//prototype of the function
triangleType triangleShape (int, int, int);

int main () //function main begins program execution
{
//declare variables
int side1, side2, side3;

triangleType triangle;
//let the user know about the program
cout << " Program that finds the triangle type.";

//promt and read input from the user
cout << "n Enter the 3 sides of the triangle.";
cout << " Side1: ";
cin >> side1;

//promt and read input from the user
cout << " Side2: ";
cin >> side2;

//promt and read input from the user
cout << " Side3: ";
cin >> side3;

//find the type of triangle
triangle =triangleShape (side1, side2, side3);

switch (triangle)
{
case scalene : cout << " Scalene Triangle.";
break;

case isosceles : cout << " Isosceles Triangle.";
break;

case equilateral : cout << " Equilateral Triangle.";
break;

case noTriangle : cout << " Not a Triangle.";
break;
}//end switch

return 0;//indicate program executed successfully
//end of function, main

//returns the type of the triangle
triangleType triangleShape (int s1, int s2, int s3)
{
//check for valid triangle or not
if ((s1>= (s2+s3) )||
(s2 >= (s1+s3)) ||
(s3 >= (s1+s2)))

return noTriangle;
else
//check for equilateral triangle
if ((s1==s2)&&(s2==s3))
return equilateral ;
else
//check for isosceles triangle
if (s1==s2)|| (s2==s3)||
(s3==s1))
return isosceles;
else
return scalene;
}

Explanation / Answer

This worked for me. I all I saw was that you didn't close main("}") and some of the if statements in the function definition weren't formatted correctly. One was missing the "(". Hope this helps! If not let me know. #include using namespace std; //enumeration type enum triangleType {noTriangle, equilateral, isosceles,scalene}; //prototype of the function triangleType triangleShape (int, int, int); int main () //function main begins program execution { //declare variables int side1, side2, side3; triangleType triangle; //let the user know about the program cout side2; //promt and read input from the user cout > side3; //find the type of triangle triangle =triangleShape (side1, side2, side3); switch (triangle) { case scalene : cout