I'm trying to make a function that assigns numbers to types of triangles when given 3 numbers. Ex: 3=equilateral, 2=isosceles, etc. But when I'm trying to call the functions into my main() it doesn't seem to work. Maybe I just don't understand functions enough :S
Your code doesn't compile because the function triangle_kind doesn't return a value. It's always good to post the actual code you're using.
1 2 3 4 5 6 7 8 9
double triangle_kind;
if(triangle_kind=0)
cout<<"This triangle is scalene.\n";
elseif(triangle_kind=3)
cout<<"This triangle is equilateral.\n";
elseif(triangle_kind=2)
cout<<"This triangle is isosceles.\n";
elseif(triangle_kind=-1)
cout<<"This is not a triangle!\n";
if (triangle_kind=0)
is equivalent to:
1 2
triangle_kind = 0;
if ( triangle_kind != 0)
To check equality you should use the == operator. Your compiler is probably giving you a warning for this that you're not paying attention to.