请问碰到了什么具体问题?
在while外面定义一个变量flag=-1,每次进while的之后就先flag*=-1;然后怎么用就不用我说了把。
没注意。
那就再定义一个变量呗。
int count=0; int flag=1 while(true){ count++; if((count%3)%2==0){ count=0; flag*=-1; printf("%d\n",flag);//打印出来看看你就知道该怎么用了 }