Can Some One Pls Decode This Game it's an assignment to make a game which should have same output.

Last edited on
I'm not going to download an .exe file from an unknown source and run it on my computer in order to help you decode an assignment.

Why don't you tell us what the game is supposed to do and tell us what the output is supposed to be.
Well the game is to find a point using arrow keys, And the point should be in x & y axis they should be randomly selected by rand(), They could be positive or negative and have limit of -10 to 10.
If the points is lets spouse X,Y (10,-9), At start our point should be zero and when we press right arrow keys the compiler will increment the value to 1 and will print "You are getting closer to point" same to y-axis. Now when we reach at x=10 and we again press right arrow keys it should print"You are going away from the point". When both x and y points are found the compiler should print"Congratulation You Found The Point". And also there should be limit moves of 20 i.e(You can only press arrow key 20 times).
The Problem With me is that i don't understand how to take input from user by arrow keys and also the limitation of the moves.
I am going to assume that you are using Borland C++ 4.1 or the like. (Alas.)

Use the conio.h library to getch() a key. Example: http://www.cplusplus.com/forum/general/73472/#msg392867

Your program should run in an event loop which terminates if the proper key is pressed (like Esc or Q).

Next, you only need to keep track of three things: the (x,y) of the random target, the (x,y) of the “current location”, and the distance between the two. Every time you press an arrow key, update the current location’s (x,y) and compare the new distance to the old. Print out one of the strings depending on how the distance has changed. Update the current distance. Loop.

Hope this helps.
Thanks