求助。
c语言吧
全部回复
仅看楼主
level 6
2006年12月19日 01点12分 1
level 6
#include
#include
#include
int main(){ int *square[]={0,0,0, 0,0,0, 0,0}; int check[]={0,0,0,0,0,0,0,0,0}; /*check[0]=0,check[1]=0,....check[8]=0*/ int x; int y; for(x=0;x<3;x++) { for(y=0;y<3;y++) { if(x==2&&y==2) break; do { srand((unsigned)time(NULL)); *(*(square+x)+y)==rand()%9; if(check[*(*(square+x)+y)]==1)/*检查随机数是不是已经存在了*/ continue; if(*(*(square+x)+y)=0)/*检查随机数是不是0*/ continue; check[*(*(square+x)+y)]=1; break; }while(1); } } getchar(); return 0; }运行不了....
2006年12月19日 01点12分 2
level 6
本意就是模拟电子字典上的数字方块游戏:12345678我想先弄出8个数来,分别用*(*(square+0)+0)*(*(square+0)+1)*(*(square+0)+2)*(*(square+1)+0)*(*(square+1)+1)*(*(square+1)+2)*(*(square+2)+0)*(*(square+2)+1)当然这8个数是1~8,不过编出来不对,谁能帮我改改。
2006年12月19日 01点12分 3
level 6
..................有空的人情帮我看看阿,谢谢。
2006年12月19日 03点12分 4
level 6
来人那,我自己已经反复看了很多遍了,就是找不出错在哪。。。
2006年12月19日 04点12分 5
level 6
不用回答了,我已经知道了。。。。。晕。
2006年12月19日 04点12分 6
level 1
晕,产生随机数用rand()%8+1就能产生1-8的数……
2006年12月19日 08点12分 7
1