I haven't been here for a long time. After learning the model, I tried to plan a graphics processing software. I have learned the model and have not learned it. I have a lot of ability to grasp the ability of the software overall situation. These two weeks have also taken the computer graphics program. In the first two days, I have introduced Direct3D. I didn't know what the API didn't know how DirectDraw. I only remember that DirectDraw was so hard. It is now just that Direct3D has not been feeling at that time, just the knowledge of matrix transformation is a big semester, now I have forgotten, I don't know how to plan a plane normal. Last night, I wrote a procedure, and I was wrong from the vector routing algorithm. I thought it was a dynamic planning issue until I saw it when I wrote it yesterday. I haven't paid an article for a long time, and I will be a bit of something to write here today. /*Routine.c TC2.0 WinXP * / # include
Typedef struct {int 4; tentNode;
Routnode Data [ROUTNUM] [ROUTNUM]; / * Routing table * /
Void initdata (file * pfile); / * read data from the data file, initialize the routing table * / void outputdata (); / * Output All Route Table * / Void Communication (int RECV, INT Send); / * Send Point Send your own routing table * / void exchange (); / * All nodes for a data exchange, update the routing table * /
Void main () {int Start, end; int i; file * pfile; pfile = fopen ("data.txt", "r"); if (pfile == null) {printf ("Data file failed to open, Press Any key to quit./N "); getch (); return;} else initdata; fclose (pfile); Printf (" / ninitial state: / n "); OUTPUTROTDATA (); for (i = 0; I Printf ("INPUT The Start Node (% D-% D):", 0, RoutNum-1); Scanf ("% D", & Start); Printf ("INPUT The end Node (% D-% d):" , 0, ROUTNUM-1; scanf ("% D", & end); if (start == end || Start <0 || START> 6 || End <0 || end> 6) {printf ("/ NWrong Input, Press any key to quit./N "); getCH (); return;} else {int cur = start; int total = 0; if (data [start] [end] .dis <0) {printf "NO ROUTINE FIND! / N"); getCH (); return;} printf ("% c->", CUR 65); while (data [cur]] .from> = 0) {Total = Data [Cur] [DATA [CUR] [END] .from] .dis; printf ("% c ->", DATA [CUR] [END] .FROM 65); CUR = Data [CUR] [END]. From;} Total = DATA [CUR] [END] .dis; printf ("% c / ntotal distance =% D", endCH (); return;}} Void initdata (file * pfile) {char NUM [10]; INT i = 0; CHAR C; INT M, N; FSEEK (Pfile, 0, 0); for (m = 0;! Feof (Pfile) && m <7 ; M ) {for (n = 0; fEOF (Pfile) && n <7; n ) {while (! feof (pfile)) {c = fgetc (pfile); if (c == ',') / * read Final a number * / {NUM [i] = '/ 0'; DATA [M] [N] .dis = atoi (num); data [m] [n] .from = -1; i = 0; Break; } Else IF ((c> = '0' && c <= '9') || c == '-') / * If you read a number or symbol * / {NUM [i ] = C;}}} } Void outputdata () {INT I, J; Printf (""); for (i = 0; i Void Exchange () {INT I, J; for (i = 0; i