ajout du centage

attention l'affichage n'est pas au bon endroit
This commit is contained in:
Balentins
2016-12-13 14:41:13 +01:00
committed by GitHub
parent 6bf323e046
commit d04a846218
+55 -14
View File
@@ -1,41 +1,82 @@
#include <stdio.h>
#include <stdlib.h>
void afficherTableau(int* tableau);
void afficherTableau(int* tableau1);
int main(void)
{
int* tableau = malloc(sizeof(int)*80*24);
FILE* fichier = fopen("Pause","r+");
int* tableau1 = malloc(sizeof(int)*80*24);
FILE* fichier = fopen("image1(2)","r+");//changer nom ----------------------------------------------------
char c = 0;
char v=0;
char b=0;
int L=0;
int C=0;
int col=0;
int lin=0;
int o=0;
while (v!='\0')
{
while (b!='\n')
{
b= fgetc(fichier);
C++;
}
v= fgetc(fichier);
L++;
b=0;
}
col=(80-C)/2;
lin=(80-L)/2;
for (o=80*lin+col+1, o=80*24-(80*lin+col+1), o=o+80)
{
if (o==78-col%80)
{
o=o+C+1;
}
}
int i=0;
int cpt = 0;
while ( cpt < 2) {
while ( cpt < 2)
{
c= fgetc(fichier);
if (c == '\n')
cpt++;
}
do {
do
{
c= fgetc(fichier);
if(c == '0' || c == '1') {
tableau[i++] = c;
if(c == '0' || c == '1')
{
tableau1[i++] = c;
}
}while(c != EOF);
afficherTableau(tableau);
free(tableau);
return EXIT_SUCCESS; /* Equivalent à return 0 sous Windows, permet un code portable */
afficherTableau(tableau1);
free(tableau1);
return EXIT_SUCCESS; // Equivalent à return 0 sous Windows, permet un code portable
}
void afficherTableau(int* tableau)
void afficherTableau(int* tableau1)
{
int i = 0;
int j = 0;
for (i = 0; i < 24; i++) {
for(j = 0; j < 80; j++) {
printf("Tableau[%d][%d] = %d\n", i, j, tableau[i*80+j]);
for (i = 0; i < 24; i++)
{
for(j = 0; j < 80; j++)
{
printf("Tableau1[%d][%d] = %c\n", i, j, tableau1[i*80+j]);
}
}
}