1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
int main() {
FILE *level;
int x,y,z;
// ouverture du fichier
level=fopen("level.txt","r");
// Création d'un tableau 3 dimension pour enregister les niveaux. int a[10][20][20];
int i=0;
x=0;
// intialisation du tableau
for(z=0; z<10; z++){
for (x=0; x<20;x++){
for (y=0;y<20;y++){
a[z][x][y] = 4;
}
}
}
while(getc(level)!= EOF){
do{
y=0;
do {
a[i][x][y]=getc(level);
y++;
}while(getc(level)!='\n');
x++;
}while(getc(level)!=';');
i++;
x=0;
}
for (y=0;y<20;y++){
printf("%d", a[0][0][y]);
//}
int fclose(FILE* level);
} |
Partager