Trying to compare 2 int arrays.
Example:
public static void Main()
{
int[] T1 = new int[3] { 1, 2, 3 };
int[] D1 = new int[3] { 4, 5, 6 };
Would like to compare value T1 index[0...3] to D1 index[0...3].
There are 3 possibilities I am interested in and capturing.
1. are they equal
2 & 3. is one < or > then the other.
Any help on structuring a compare or equals statement would be appreciated.
Loading
Kirtan PatelPosted Jul 31, 2009, 1:11 AM
H GhasemiPosted Jul 31, 2009, 12:59 AM
Danatas GerviPosted Jul 29, 2009, 11:54 AM
But what do you mean as "array index"?
Sum of all elements? Lenght of array? Index - this is number of element in array!
Your task is not usial - seems you want to compare only first element of boths arrays....
so it may be shorter to write :
Lets continue to develope the algoritm of comparing:
take t - array of int and d - array of int.
if t[0] > d[0] -> true or false
if t[1] > d[0] -> true or false
if t[2] > d[0] -> true or false
if t[0] > d[1] -> true or false
if t[1] > d[1] -> true or false
if t[2] > d[1] -> true or false
if t[0] > d[2] -> true or false
if t[1] > d[2] -> true or false
if t[2] > d[2] -> true or false
how do you want to collect the resut?
H GhasemiPosted Jul 29, 2009, 11:04 AM
Danatas GerviPosted Jul 29, 2009, 2:52 AM
May be array of results?