Logic AND between some strings

Поиск
Список
Период
Сортировка
Искать

Logic AND between some strings

От:
yagru_alvarez <jmalvarez@estudiantes.uci.cu>
Дата:
I want to make a Logic AND between some strings of 0s and 1s .. Here
you have an example:

1-> 01100010
2-> 00001100

I wanto to make a LOGIC AND between 01100010 and 00001100.

I' m working with C++, I need some code to have an idea about how I
can perform that.

Re: Logic AND between some strings

От:
Bill Thoen <bthoen@gisnet.com>
Дата:
Just to make sure, you're asking for the logical AND, not the bitwise 
AND? In other words you're not talking about getting into bit shifting 
with << and >> and masking with &?

For the logical AND, you need to use expressions that evaluate to TRUE 
or FALSE, and follow the rules in this "truth table":

Expr 1    Expr 2     AND returns
true        true         true
true        false        false
false       true         false
false       false        false

like 01100010 == 00001100 AND 01100010 > 00001100 would evaluate to 
false AND true (depending on how you interpret these bitstrings), and so 
that evaluates to false. If you're dealing with bitstrings (text made up 
of only zeros and ones), then I'd implement this by just using text 
comparisions, since bitstrings are just text and have the same 
comparision behavior as the unsigned integers  they could represent.





On 3/7/2011 7:25 AM, yagru_alvarez wrote:
> I want to make a Logic AND between some strings of 0s and 1s .. Here
> you have an example:
>
> 1->  01100010
> 2->  00001100
>
> I wanto to make a LOGIC AND between 01100010 and 00001100.
>
> I' m working with C++, I need some code to have an idea about how I
> can perform that.
>

FAQ