Today, I saw Josephus questions, suddenly I want to write some things, combined with my own thoughts, so I wrote these posts. Because there are a few code a bit long, I will be developed. If you have any help you have, I am gratifying. Maybe you will say that there is a lot of books in this question, but I am writing in different ways, so that beginners will experience the difference between the facing-oriented object; and you can also see what I wrote. And the differences in some books. If you are a prawn, you can smile, or enlighten me.
Josephus question: Several children are enclosed in a circle, from any child spacing M. The child will leave when every time to M-child, the child leaves. The last thing left is a winner. The first few is the winner?
/ / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ / Method 1: A number of applications // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ # include
Void main () {int Num, Interval, * array; cout << "please input the number of chirlder:"; cin >> Num; if ((array = new int [num]) == null) {cout << "Can't instocate more memory, term"; exit (1);} for (int i = 0; i