in reply to Re^2: Perl hex substraction
in thread Perl hex substraction

How would you do it without a computer? What part of the task do you have difficulties with?

Replies are listed 'Best First'.
Re^4: Perl hex substraction
by inkubus (Initiate) on Feb 15, 2011 at 13:20 UTC
    Ok, without computer.
    I have a sentence with numbers like (let's forget about hex):
    50 40 30 12 8 4 2
    I know this is some for of an encrypted message, and to get the message decoded every number must be substracted the next one from it:
    50 - 40 = 10 40 - 30 = 10 30 - 12 = 18 12 - 8 = 4 8 - 4 = 4 4 - 2 = 2 2 - 0 = 2
    So my result, my decoded sentence would be:
    10 10 18 4 4 2 2

      Where do you have problems with implementing this (a bit modified) problem?

      Can you see a way to turn this modified problem into your original problem?

      A first step in solving the problem could be to get at the numbers from the string.

Re^4: Perl hex substraction
by inkubus (Initiate) on Feb 15, 2011 at 12:48 UTC
    Let's say I have these hex numbers in a list or array:
    4d 2c 07 2c 77
    Every number in this array should be substracted from it the next one to it like:
    4d - 2c = 21
    so I get my result. My solved problem is that from this array I get the result of every number bring the output of substracting the next one from itself and print the result instead the original one.

      You haven't told me how you would do it without a computer, you have just restated your problem.

      Describe the steps in English sentences. Fewer than 7 words per sentence. Only use simple steps. Prefer additional steps over more words.