Jump to content

programming


hisoka

Recommended Posts

if we have this little code

 

 

function sum (){var a = 135;var d = a << (150 - a % 32);var c = d << (160 % 53 + 3*2 +7);var y = 78945666 - d ;var b = a+d+c+y ;return b ;}

 

what does it mean to reverse it that is what does it mean to reverse a code??

 

does it mean that we should reverse the operators of the code like this :

 

 

function reverse sum(){var a = 135 ;var d = a >> (150 + a % 32);var c = d >> (160 % 53 - (3/2)-7);var y = 78945666 + d ;var b = a+d+c+y ;return b;}

 

or it means that we should begin the code from the bottom to the top

 

like this function reverse sum()

 

{

var b = a+d+c+y ;

var y = 78945666 - d ;

var c = d << (160 % 53 + 3*2 +7);

var d = a << (150 - a % 32);

var a = 135;

}

 

???

Link to comment
Share on other sites

I assume what it means is to create a function that takes what the other one outputs and return what was put into it. That is, if function A takes in 5 and outputs 23, then function B needs to take in 23 and output 5.

 

Your code doesn't seem to have any inputs, so perhaps that definition doesn't fit. Where did you find the question?

Link to comment
Share on other sites

both functions are not related in anyway and the same for their output . I put them only to make my question more clear. Generally and in the context of programming, what does it mean to reverse a code or a script ? does it mean that the execution begins from the bottom to the top ? or that the operators are reversed 1+1 = 2 becomes 1-1=0 ? or that the result of the execution of the code is reversed like 01001000 binary becomes 10110111 or false becomes true ? or 150 becomes -150?

Link to comment
Share on other sites

Can you point to an article where you read about reversing code? It depends on the context.

 

Reversing a string means putting the letters in reverse order, "Hello, World!" becomes "!dlorW ,olleH"

Reversing a function would be to make a function that does the opposite, which I explained in my previous post.

Reversing the order of execution would mean writing the lines of code in reverse order.

Link to comment
Share on other sites

"Reversing the order of execution would mean writing the lines of code in reverse order"

 

Interesting . but what do you mean in reverse order ? you means from the bottom to the top ? Can you please give me a clear and short example on how to write the lines of the code in the reverse order as you wrote ?

 

execution from the top to the bottom

 

a+b=c;

 

c+d=e;

 

e+f=g;

 

when you reverse it it becomes like this :

 

execution from the bottom to the top

 

e+f=g;

 

c+d=e;

 

a+b=c;

 

is this what you mean?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...