#include #include #include int verif2(char tab[][10]){ int v=0; int i; int j; for (i=0;i<10;i++){ for(j=0;j<10;j++){ if(tab[i][j]!=' '){ v++; } } } if(v==17){ return 1; } return 0; } void ajoutNavireAleatoire2(char tab[][10],char b,int t){ srand(time(NULL)); int o=(rand()%2); int x; int y; int i; int j; int v=0; int w=0; if (o==0){ while (v==0){ srand(time(NULL)); w=0; x=(rand()%(10-t)); y=(rand()%10); for (i=x;i10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j+5>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(j=coord;j10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(i=cord-'A';i10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j+4>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(j=coord;j10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(i=cord-'A';i10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j+3>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(j=coord;j10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(i=cord-'A';i10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j+3>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(j=coord;j10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(i=cord-'A';i10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j+2>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(j=coord;j10 || i<0){ printf("Navire hors limite\n\n"); }else{ j=coord; if (j>10 || j<0){ printf("Navire hors limite\n\n"); }else{ for(i=cord-'A';i10 || x<0){ return -3; } if (y>10 || y<0){ return -3; } switch(adv[x][y]){ case 'A': adv[x][y]='x' ; return 0; case 'C': adv[x][y]='x' ; return 1; case 'S': adv[x][y]='x' ; return 2; case 'M': adv[x][y]='x' ; return 3; case 'T': adv[x][y]='x' ; return 4; case ' ': adv[x][y]='.' ;return -1; } return -2; }