Fórum bit da char #283779
03/06/2005
0
obrigado
Eduardo
Edusjc
Curtir tópico
+ 0Posts
03/06/2005
Beppe
for I := 0 to 7 do
if Ord(Ch1) and (1 shl I) <> Ord(Ch2) and (1 shl I) then
{ os bits diferem }Gostei + 0
13/06/2005
Edusjc
obrigado
Gostei + 0
14/06/2005
Beppe
Para testar os mais significativos, vc testa o 6 e o 7.
Gostei + 0
14/06/2005
Edusjc
por exemplo, se eu coloco em uma variavel do tipo char, o equivalente ao 254 em decimal que quer dizer 11111110, eu deveria mostrar uma mensagem de que a chave 1 foi acionada então fiz o seguinte código
if Ord(ch) and (1 shl 7)<>0 then if Ord(ch) and (1 shl 6)<>0 then begin if ord(ch) and (1 shl 0)=0 then memo1.Lines.Add(´chave1´) else if ord(ch) and (1 shl 1)=0 then memo1.Lines.Add(´chave2´) else if ord(ch) and (1 shl 2)=0 then memo1.Lines.Add(´chave3´) else if ord(ch) and (1 shl 3)=0 then memo1.Lines.Add(´chave4´) else if ord(ch) and (1 shl 4)=0 then memo1.Lines.Add(´chave5´) else if ord(ch) and (1 shl 5)=0 then memo1.Lines.Add(´chave6´)
só que com esse código ele não apresenta nenhuma mensagem. Tem algum erro no que digitei??
obrigado
Eduardo
Gostei + 0
15/06/2005
Beppe
Gostei + 0
15/06/2005
Edusjc
Gostei + 0
15/06/2005
Beppe
var
Ch: Char;
begin
Ch := #254;
{ aquele seu código aqui }
end;
end;Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)