#include #include #include #include int main () { char coord[10] = {'A','B','C','D','E','F','G','H','I','J'}; int grilleJoueurUn[10][10], grilleJoueurDeux[10][10]; int i, j, x=0, y=0, bateauxJoueurUn, bateauxJoueurDeux, partieTerminee = 0; //initialisations des grilles à 0 for (i = 0 ; i < 10 ; i++) { for (j = 0 ; j < 10 ; j++) { grilleJoueurUn[i][j] = 0; grilleJoueurDeux[i][j] = 0; } } while (partieTerminee != 1) { //JOUEUR UN printf("*** Grille Joueur Un ***\n\n"); //afficher la grille getc(stdin); for (i = 0 ; i < 10 ; i++) { for (j = 0 ; j < 10 ; j++) { printf("%d ",grilleJoueurUn[i][j]); } printf("\n"); } printf("\nEntrez des coordonees de tir : "); //demande des coordonées scanf("%d %d",&x,&y); if ((x >= 0 && y >= 0) && (y >= 0 && y <= 10)) //coordonées >0 et <10 { if (grilleJoueurDeux[x-1][y-1] == 1) //deja tire dans cette case { printf("Vous avez deja tire en %c%d\n",coord[x],y); } else { grilleJoueurDeux[x-1][y-1] = 1; //tirer printf("Vous tirez en %c%d\n",coord[x],y); } } getc(stdin); //JOUEUR DEUX printf("*** Grille Joueur Deux ***\n\n"); //afficher la grille getc(stdin); for (i = 0 ; i < 10 ; i++) { for (j = 0 ; j < 10 ; j++) { printf("%d ",grilleJoueurDeux[i][j]); } printf("\n"); } printf("\nEntrez des coordonees de tir : "); //demande des coordonées scanf("%d %d",&x,&y); if ((x >= 0 && y >= 0) && (y >= 0 && y <= 10)) //coordonées >0 et <10 { if (grilleJoueurUn[x-1][y-1] == 1) //deja tire dans cette case { printf("Vous avez deja tire en %c%d\n",coord[x],y); } else { grilleJoueurUn[x-1][y-1] = 1; //tirer printf("Vous tirez en %c%d\n",coord[x],y); } } } printf("\n\nAppuyez sur une touche pour continuer..."); getc(stdin); }