By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,465 Members | 1,501 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,465 IT Pros & Developers. It's quick & easy.

Logic(Array) in C#(V1.1)

P: n/a

Hi,

What is the logic to compare Values.

First array={5,5,6,7};
Second array={5,3,3,2};

Explanation:
1.First array first element is greater than the second array first
element, No need to check remaining cases.
2.First Array First Element is same as second array First element then
we need to check first array second element to second array second
element.
3.If First Array second element is greater than the second array second
element no need to check remaining cases...

Remainig cases also same as the above...

Please do the help.

Thanks in Advance.

regards

*** Sent via Developersdex http://www.developersdex.com ***
Mar 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Kondapanaidu" <kondapanaidu> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...

Hi,

What is the logic to compare Values.

First array={5,5,6,7};
Second array={5,3,3,2};

Explanation:
1.First array first element is greater than the second array first
element, No need to check remaining cases.
2.First Array First Element is same as second array First element then
we need to check first array second element to second array second
element.
3.If First Array second element is greater than the second array second
element no need to check remaining cases...

Remainig cases also same as the above...

Please do the help.

Thanks in Advance.

regards

Are the contents of the array elements always going to be integer? If so
convert them to a number with the same number of digits and then compare. So
in your example {5,5,6,7} = 5567 and {5,3,3,2} = 5332 and the check is (5567 5332), etc. Should simplify it.
If the elements are not always integer then you'll have to check the
elements using a loop unless c# has a built in function to do this that I'm
not aware of.


*** Sent via Developersdex http://www.developersdex.com ***

Mar 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.