Recently, I have seen many programs with Joseph problems in C language, including C and C ++. the implementation methods are linked lists, and basically no arrays are used. I have previously used pascal to write an array and a linked list to solve this problem separately. Now I will rewrite the implementation process of the array method in C language for reference. If there are any errors or omissions, please correct.
/* ===================================================== =================== */
/* Program name: arrayList. c */
/* Program objective: to implement Joseph's problem using arrays */
/* Program Author: aibd (computer 021 )*/
/* ===================================================== =================== */
# Include <stdio. h>
# Define size 100/* Maximum number of input users */
Void main ()
{
Int person [size];
Int I, j;/* cyclically corrected variable */
Int arrayLen;/* array length */
Int start, overNum;/* start position and cross position */
Int deleNum;/* subscript in the array where the columns are located */
Int name, total;/* enter the person information and total number of people */
Printf ("Enter the total number of round tables :");
Scanf ("% d", & arrayLen); printf ("n ");
If (arrayLen> size) | (arrayLen <0 ))
{
Printf ("out of range, please enter again :");
Scanf ("% d", & arrayLen); printf ("n ");
};
Printf ("enter individual information (integer): n ");
For (I = 0; I <arrayLen; I ++)
{
Scanf ("% d", & name );
Person [I] = name;
}
Printf ("the order of your input data is: n ");
For (I = 0;
<