Hey everytime I run this it outputs the else of neither no matter what I enter. And I checked my conditions and the logic seems right but maybe I'm wrong. Help please!

#include <iostream>
#include <cmath>
using namespace std;

int main(){

int n1, n2, n3;

cout<<"Enter the three sides of a triangle\n";
cin>> n1, n2, n3;

if(n1<0 || n2<0 || n3<0)	
	abs(n1);
	abs(n2);
	abs(n3);
	
	if(n1 == n2 && n1==n3 && n2 == n3)
	{
		cout<<"Equilateral";
	}
	else if(n1 == n2 || n1==n3 || n2 == n3)
	{
		cout<<"Isosceles";
	}
	else if(n1*n1+n2*n2 == n3*n3 || n1*n1+n3*n3 == n2*n2 || n3*n3+n2*n2 == n1*n1)
	{
		cout<<"Right-angle";
	}
	else 
	{	
		cout<<"Neither";
	}
return 0;
}

try cin>>n1>>n2>>n3;

Like 4olkata said use cin >> n1 >> n2 >> n3; because the comma does not work like that in C++.

Also abs(n1) does nothing because that will just return the absolute value of n1. You want n1 = abs(n1); because this will assign n1 to the absolute value of n1.

Then just to drop one check for the equilateral you only need if( n1 == n2 && n1 == n3 ) because that would mean that n2 and n3 are equal also.

Holy crap thank you I don't know how I missed that; I feel really stupid now thank you guys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.