"Siva" <sa**********@utep.edu> wrote:
I'm working a long code, part of which is as follows.
I get 2 numbers from 2 different field. Now I want to compare the 2
mumbers and see if atleast one of the digits are matching. for example:
A=123 and B=435. And I want to check if atleast one of the digit is
matching. In this case 3.
What exactly do you mean by "compare" and "match"?
In your example, you say that the digit '3' "matches"
between the strings "123" and "435". And yet, it doesn't
"match" in a place-value sense. Do you mean in a "set"
sense? That is, "is the intersection of the sets {1,2,3}
and {3,4,5} non-empty?"? If so, look-up information on
std::set. You could put all the digits of one number-string
in a std::set, then iterate through the digits of a second
number-string and ask, for each digit, if it matches any
element of the set.
But I'm just guessing at your intentions. If you clarified
what you mean by "compare" and "match", perhaps I could help
more.
--
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant