M
M
Mister2015-03-29 07:25:31
Programming
Mister, 2015-03-29 07:25:31

What program can I paste the Gray Code into?

unsigned int graydecode(unsigned int gray) 
{
    unsigned int bin;
    for (bin = 0; gray; gray >>= 1) {
      bin ^= gray;
    }
    return bin;
}

-------------------------------------------------- ----------
function GrayToBin(b: integer): integer;
 var g: integer;
begin
  g := 0;
  while b > 0 do begin
    g := g xor b;
    b := b shr 1;
  end;
  GrayToBin := g;
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2015-03-29
@MrSITE

You can write a tutorial to teach gray coding "by hand". The program can work according to a modified scheme of the game "field of miracles" (repetitions are not disclosed) - at the beginning of the round they are told what number and how many digits are encoded, then the player guesses the digits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question