功能:每次按钮按下,就会生成一个整数,然后达到最大值再返回0。
我想要最短的实现算法。
比如像这样。从0到6,再从6到0。
count ++; count *= (count != 7);
使用模数
count = (count + 1) % 7