#include
#include
#define number 13 // You can use the number of people's number #define next 8 // to determine the number of points of the number #define length sizeof (men) #define null 0
Struct Men {Int Number; Struct Men * Pmen;
Typedef struct men men;
/ ***************************************************** / / * Joseph Circulatory chain table realization * // **************************************************** * / void main () {men * pone = null, * ptwo = null, * PHEAD = NULL; int client
/ * * Create a ring chain list * / PHEAD = PONE = PTWO = (men *) malloc (length); PHEAD-> Number = 1; for (Client = 2; client <= number; client ) {Pone = (Men *) Malloc (length); ptwo-> pmen = pone; pone-> number = client; ptwo = pone;} Pone-> Pmen = PHEAD; / * * Operation * / PTWO = PHEAD; PONE = PTWO-> Pmen; While (Pone-> PMen! = PTWO) {for (Client = 0; Client
}
There is a power implementation for each bit:
#include
#define longth sizeof (men) #define null 0
Struct Men {Int Number; int code; struct men * pmen;
Typedef struct men men;
//// Joseph's circular chain table is implemented //
Void main () {men * pone = null, * ptwo = null, * pHead = null; int client; int number = 13; // Setting the default number int next = 3; // The selected number interval initial interval Number // // Printf ("Please enter the number of games:"); scanf ("% d", & number); // // Create an annular chain list // PHEAD = Pone = ptwo = (men *) Malloc (Length); if (PHEAD == NULL) {Printf ("head knot spatial allocation error!"); return;} // // Initial linked list, assignment to head node // pHEAD-> Number = 1 PRINTF ("Please enter the first bit of password:"); scanf ("% d", & phet-> code); for (client = 2; client <= number; client ) {Pone = (Men *) malloc Length); if (pone == null) {printf ("Space Assignment Error!"); Return;} PTWO-> PMEN = PONE; PONE-> Number = Client; Printf ("Please enter the password of the% D bit: ", client); scanf ("% d ", & pone-> code); PTWO = PONE;} Pone-> Pmen = PHEAD;
Printf ("/ N is selected in the order: / n"); // // Operation / PTWO = PHEAD; PONE = PTWO-> Pmen; While (Pone-> PMen! = PTWO) {for (client = 0; Client