Tragedy caused by one question

Source: Internet
Author: User

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]);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.