You will not be forgotten, Eleanor / Steam ID / DeviantArt page / YouTube / Twitter
i just saw crystal castles live four minutes from my apartment
nightfury treann
+ 5
+ 4
Sorry went to bed.
Have to make a programme that reads in 3 numbers from the users that represent lines and says if it's an equilateral, scalene or isosceles triangle. It also needs to give an error message if the triangle can't exist. Like one side is far to big or something.
I am about to have chicken alfredo. Jelly much?
+ 3
That's a nasty program to start with
+ 4
+ 2
In response to this quote and the other related posts by others (im in bed on the phone):
The coding itself is really simple. What you need is to find the mathematical functions and implement them in ur code.
I dont know what those three words mean but I could guess, and if my guess is correct then the task isnt hard.
Equilateral => all sides are the same lenght right? Very simple to implement in code. If (a == b and b == c) //whatever u wanna return or print goes here.
Ill google the other two quick.
+ 5
Sometimes I wish the English terms for math stuff wouldn't be so different from the Dutch terms.. that post sounds all gibberish to me right now
+ 3
if its c++ just like
you should probably add an if-parameter for checking if the values are valid (just uh.. if(side1<0 || side2<0 || side3<0) or something)Code:if(side1==side2 && side2==side3) { cout << "equilateral triangle yo"; } else if(side1==side2 || side2==side3 || side1=side3) { cout << "isosceles triangle yo"; } else if(side1!=side2 && side2!=side3 && side1!=side3) { cout << "scalene triangle comin yo"; }
i think thats how it works i took c++ in high school so its rusty
+ 4
Equilateral = all sides are equal
Isosceles = 2 sides equal (generally, equilateral triangles are considered to be isosceles as well)
Scalene = all sides different
Also, to be a triangle, the sum of the two smaller sides must be larger than the hypotenuse (the big side), i.e. X + Y > Z, where X and Y are sides, Z is the hypotenuse.
Yeah I was right.
For scalene:
if (a==b and a!=c or a==c and a!=b or b==c and b!=a) //return scalene
If it wont work with so many ands and ors just use an else if for each.
As for the last one:
if (a!=b and b!=c and a!=c) //return isosceles
Note that all three need to be compare to another. Just because b is not equal to a doesnt mean that c is not equal to a because it is not equal to b.
Id love to type it out more clearly but phone...
---------- Post added 2013-03-07 at 02:22 AM ----------
Long is pretty much on spot. Except you probably need to check the last side on the scalene one aswell.