回复 6楼
话说我输入#include<conio.h>检查的时候提示有一个错误:fatal error C1083: Cannot open include file: 'conio.h': No such file or directory是什么情况,请大哥帮忙解释下,我是新手~
Press any key to continue_
#include <stdio.h> int main(int argc, char* argv[]) { const int N=10; const int M=3; const int S=1; int array[N]; for(int i=0;i<N;++i) array[i]=i+1; printf("%d个人围成一圈\n",N); printf("从1开始,逢%d退出(模拟置0标示退出),剩余%d人时退出。\n\n模拟源数组:\n",M,S); for(int i=0;i<N;++i) printf("%d ",array[i]); int count=N; int j=0; do { if(count==S) break; for(int i=0;i<N;++i) { if(array[i]) { ++j; if(j%M==0) { array[i]=0; --count; } } } }while(1); printf("\n模拟目标数组:\n"); for(int i=0;i<N;++i) printf("%d ",array[i]); getchar(); return 0; }