Tuesday, 20 August 2013

Convert string[] to int

Convert string[] to int

I have an array of integers in string form.
string [] TriangleSideLengths
In this array there is going to be 3 int values which represent side
length of a triangle. Is there a way from which I can extract individual
all 3 values from my array TriangleSideLengths into three int objects like
int intSideLengthOne,intSideLengthTwo and intSideLengthThree.
I want to be able to test if these three values actually form a valid
triangle?
For instance, entering lengths 10, 10, 100000 wouldn't make it a valid
isosceles triangle.
I wanna be able to do this check with the three values stored in my array
TriangleSideLengths.
a + b > c
a + c > b
b + c > a
Any help is greatly appreciated. Thanks a lot!! :)

No comments:

Post a Comment