OS problems for code cocos2d-x C
Yesterday in a group of cocos2d-x, a group of friends sent a question for the answer, at that time I also did not expect any good writing, at this time a group of friends wrote a relatively rare code method, when I saw this code, I felt like a bit confused, because I didn't use this method at ordinary times. Today, in other groups, I published this question for everyone to discuss, unexpectedly, it caused various quarrels and discussions, some of which were poorly written but self-righteous, some of which were well written but did not look down on others' writing, some of which were well written but very low-key and wonderful, it is also a lively atmosphere in the group, and the QQ Group has also become a concentrated social well.
The following is a question and the code written by the group of friends yesterday. I think the most amazing thing is the modulo phrase. His code may not be the most efficient, but I personally feel that this code can reflect the strong thinking of this group of friends. You are welcome to comment. The level of personal care is limited and you do not dare to criticize it.
Problem:
Take an array, starting from any position, and let it loop again? Or, from any position in the array, assign values to the other array, and complete the loop once.
For example: int [] T = {1, 2, 3, 4, 5, 6}; I want to output 3, 4, 6, 1, 2
Code written by a group of friends:
Int I = 3
For (Int J = 0 J ++ j <t. lenth)
{
Int A = (I + J) % T. lenth;
Printf ("% d", t [a]);
}