Giusto.. %9 non %10 !!
Questo è il codice intero
Ovviamente ci sono delle funzioni non definiteche appena risolto il problema definiròcodice:#include <stdio.h> #include <time.h> #define MENU 0 #define OUT 130 #define CREA 1 #define GIOCA 2 int menuSud(void); int creaSud(void); int playSud(void); int testSud(void); int numero; /* NUMERI DA INSERIRE NELLE CELLE */ int tavola[8][8]; /* CELLE TAVOLA */ int i, j; /* RIGHE E COLONNE TAVOLA */ int c; /* CONTATORE INSERIMENTO NUMERI NELLA TAVOLA */ main() { srand(time(NULL)); //inizializza il generatore int scelta=MENU; while (scelta!=OUT){ switch(scelta) { case MENU: scelta=menuSud(); if (scelta==MENU) scelta=OUT; break; case CREA: creaSud(); scelta=MENU; break; case GIOCA: playSud(); scelta=MENU; break; } } } /* MENU */ int menuSud(void) { int scelta; char invio; int vero=1; while (vero) { printf("\n\n\n\n"); printf("\t\t\t Sudoku"); printf("\n\n\n\t\t\t 1. Crea un nuovo Sudoku"); printf("\n\n\t\t\t 2. Gioca"); printf("\n\n\n\t\t\t 0. Esci"); printf("\n\n\n\t\t\t\t Scegliere un'opzione: "); scanf("%d", &scelta); scanf("%c", &invio); switch (scelta){ case 1: case 2: case 0: return(scelta); default: break; } } return(0); } int creaSud(void){ for(i=0; i<9; i++) {/* INIZIALIZZO A 0 TUTTE LE CELLE */ for (j=0; j<9; j++) tavola[i][j]=0; }/* FINE INIZIALIZZAZIONE A 0 */ for(c=0; c<26; c++) {/* INSERIMENTO NUMERI */ i = rand() % 9; j = rand() % 9; numero=rand() % 9; numero++; tavola[i][j]=numero; }/* FINE INSERIMENTO NUMERI */ for(i=0; i<9; i++) { printf("\n\n"); for (j=0; j<9; j++) printf("%4d", tavola[i][j]); } } int playSud(void){}

Rispondi quotando