Programmer account notes (8)

xiaoxiao2021-03-06  96

Today, I haven't lectured, because the teacher is busy with some other things, I heard that it seems to be a multimedia game, I have to pay today. Then we have to return to the books in the classroom, but we haven't seen any books during this time, just everyone talked. I also inserted a few words, but I was so sincerely, hehe! I have to sleep for a while. When I took a break, I found that the teacher had already come back, and said to let us go online today. Today is the first time in the machine room, but if I am not, I don't want to go to the machine room, because I think the teacher is okay. We went to the computer room, and the teacher gave a procedure us, hey! This is not the Noko Tower you want to do before two days! Moreover, it is combined with graphical representation. We are all excited and began to study this procedure. I started to implement this Nota. He gave the parameters not a lot, just ten plates, do you know how long I have pressed? I have been watching and watching it after a five-minute walk. This problem is really complicated. Looking at these drawing demonstrations made me more clearly understand the principle of Norhan Tower, I don't dare to selfish here, I will go home from the source program, the following is:

#include

#include

Char DD [10] [20], Space [20];

INT A [11], B [11], C [11];

init ()

{

INT I, J;

For (i = 0; i <20-1; i ) Space [i] = '';

Space [I] = '/ 0';

For (i = 0; i <10; i ) {for (j = 0; j <20-1; j ) DD [i] [j] = ''; DD [i] [j] = '/ 0' For (j = 9-i; j <= 9 i; j ) DD [i] [j] = 'a' i;} for (i = 0; i <10; i ) a [i] = I, B [I] = - 1, C [i] = - 1;

A [10] = 2, B [10] = 25, C [10] = 50;

For (i = 0; i <10; i ) {gotoxy (a [10], 10 i); CPRINTF ("% s", DD [i]);}}

Move (int * s, int * d) {INT I, J; for (i = 0; s [i] == - 1 && i <10; i ); gotoxy (s [10], 10 i); CPRINTF "% s", space); for (j = 0; D [j] == - 1 && j <10; j ); j -; gotoxy (d [10], 10 j); CPrintf ("% s" , DD [S [I]]); D [j] = s [i]; s [i] = - 1; getChe ();}

Void Hanoi (int N, INT * S, INT * W, INT * D) {INT i; if (n == 1) Move (S, D); Else {Hanoi (N-1, S, D, W) ; Move (S, D); Hanoi (N-1, W, S, D);}}

转载请注明原文地址:https://www.9cbs.com/read-124131.html

New Post(0)