Yes u'll have to use few graphics statements like( Gotoxy) and not more than tat; only when u need to construct a grid i.e to show 16 boxes and number inside it.
On 11/29/07, bhavana agrawal <[EMAIL PROTECTED]> wrote: > > do u have to make this game using graphics programming or MFC???? > > vivu2387 <[EMAIL PROTECTED] <vivek.es2386%40gmail.com>> wrote: --- In > [email protected] <c-prog%40yahoogroups.com>, "amee_ahmd" > <[EMAIL PROTECTED]> wrote: > > > > Hi,i m a student and i have an assignment to make a puzle in which > i > > have to use random numbers from 0 to 16 in a 2d array and a box at > the > > place of 0.And user will bring it in ascending order by the > movement > > of arrow keys.What i can do to perform that if any body knows plz > help > > me, i will b very thank full to his/her.thanks > > > > So u need to use a 4x4 matrix (1-15nos and a zero as a blank box). > > Now use getch() to get th arrow keys from the keyboard(ASCII codes > of > arrow keys). > > 1 2 3 4 > 6 9 7 8 > 10 11 15 14 > 5 12 13 0 > > assume th matrix as arr[i][j]... > keep track of the position of "0/box".say initially its posn is a[4] > [4]. > > when u press up or down, only th row number changes. thus just swap > th > conents of posn zero i.e a[4][4] and a[3][4]. > > 1 2 3 4 > 6 9 7 8 > 10 11 15 0 > 5 12 13 14 > > tis happens when u press up. > > now increment(up)/decrement(down) the i.(to keep track of new posn > of > zero). > > when u press left/right only the column number changes i.e j. > again swap th contents frm zero posn and a[][j]. > > 1 2 3 4 > 6 9 7 8 > 10 11 0 15 > 5 12 13 14 > > u get this when u press left > > so use switch() or any other conditional statements to choose wat > operation shud be done on pressing a particular key. > > hope u've understood the concept.... > > try... > > if u don get not ... > > contact:[EMAIL PROTECTED] <vivek.es2386%40gmail.com> > > --------------------------------- > Bollywood, fun, friendship, sports and more. You name it, we have it. > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed]
