...so I'm trying to make a program that takes in the three sides of a triangle and then decides whether the triangle is equilateral, isosceles or equilateral.
I have to have 2 different functions and I can't use global variables ( That's what my teacher wants ). My main function keeps looping which is not what i want my program to do. I couldn't find what im doing wrong. Any help is appreciated.
P.S. I don't use dev C++ anymore. I've started using Code::Blocks.
Here's my code-
#include <cstdlib>
#include <iostream>
using namespace std;
int calculations();
int main(){
int side1 = 0;
int side2 = 0;
int side3 = 0;
cout << "Enter side 1: " << endl;
cin >> side1;
cout << "Enter side 2: " << endl;
cin >> side2;
cout << "Enter side 3: " << endl;
cin >> side3;
calculations(side1, side2, side3);
return 0;
}
int calculations(){
cout << side1 << endl;
int side1 = main();
int side2 = main();
int side3 = main();
if ((side1 == side2)&&(side1 == side3)&&(side2 == side3)){
cout << "The triangle is Equilateral" << endl;
}
if ((side1 == side2)||(side1 == side3)||(side2 == side3)){
cout << "The triangle is Isosceles" << endl;
}
if ((side1 != side2)&&(side1 != side3)&&(side2 != side3)){
cout << "The triangle is Scalene" << endl;
}
cout << "" << endl;
return 0;
}