Demande aide pour c
celine
-
Jeff -
Jeff -
prog qui lit des fichiers et met les elements dans tableaux.quelles sont erreurs.merci!!!!!!!!!!!!!!!
# define ligne 30000
# define colonne 30
# define colonneg 60
# include <stdio.h>
main()
{
int connexion (int (x)); /* prototype des fonctions */
void remplissage(void);
void remplissagetab(void);
char tab1[ligne][colonne], tab2[ligne][colonne], tab3[ligne][colonneg];
char mot, textelu;
int i, j, k, l, m, n, x, a; /* declaration des variables */
a=0;
x=1;
for (x=1;x<5;x++)
{
x=connexion (x);
do
{
remplissage();
a=a+1; /* compteur qui permet un remplissage net du tableau */
}while ((textelu=getchar())!= '/(0)');
}
for (j=0; j<ligne; j++)
{
for (i=0; i<colonne; i++)
{
for (l=0; l<ligne; l++)
{
for (k=0; k<colonne; k++)
{
if ((tab1[0][0]==tab2[0][0]) && tab1[0][2]==tab2[0][2] && (tab1[0][11]==tab2[0][5]))
{
for (n=0; n<ligne; n++)
{
for (m=0; m<colonne; m++)
{
tab3[n][m]=tab1[j][i];
for (m=m+1; m<colonneg; m++)
{
tab3[n][m]=tab2[l][k];
}
}
}
}
}
}
}
}
/* mise en place du tableau 3 dans un fichier */
for (n=0; n<ligne; n++)
for (m=0; m<colonne; m++)
tab3[n][m]== //Triv/C:/projet celine/testsubsrib.log;
}
/* description des fonctions */
/* 1 fonction */
int connexion (int (x))
{
switch (x)
{
case 1: //Triv/C:/projet celine/essailocal/pbx001/subsrib.log
//Triv/C:/projet celine/essailocal/pbx001/grp.log
break;
case 2: //Triv/C:/projet celine/essailocal/pbx002/subsrib.log
//Triv/C:/projet celine/essailocal/pbx002/grp.log
break;
case 3: //Triv/C:/projet celine/essailocal/pbx003/subsrib.log
//Triv/C:/projet celine/essailocal/pbx003/grp.log
break;
case 4: //Triv/C:/projet celine/essailocal/pbx004/subsrib.log
//Triv/C:/projet celine/essailocal/pbx004/grp.log
break;
}
return (x);
}
/* 2 fonction */
void remplissage (void)
{
for ( j=a; j<ligne; j++)
{
do
{
for (i=0; i<colonne; i++)
{
while ((textelu=getchar()) != '/(59)')
{
mot = mot,textelu;
mot=getchar();
}
if ((mot=getchar()) != tab1[mot][j])
{
mot = tab1 [mot][j];
mot = '';
else
remplissagetab();
}
}
}while ((textelu=getchar()) != '/n');
}
return ;
}
/* 3 fonction */
void remplissagetab (void)
{
for (l=0; l<ligne; l++)
{
do
{
for (k=0; k<colonne; k++)
{
do
{
mot = mot,textelu;
mot=getchar();
}while ((textelu=getchar()) != '/(59)')
mot = tab1 [mot][j];
mot = '';
}
}while ((textelu=getchar()) != '/n');
}
return ;
}
# define ligne 30000
# define colonne 30
# define colonneg 60
# include <stdio.h>
main()
{
int connexion (int (x)); /* prototype des fonctions */
void remplissage(void);
void remplissagetab(void);
char tab1[ligne][colonne], tab2[ligne][colonne], tab3[ligne][colonneg];
char mot, textelu;
int i, j, k, l, m, n, x, a; /* declaration des variables */
a=0;
x=1;
for (x=1;x<5;x++)
{
x=connexion (x);
do
{
remplissage();
a=a+1; /* compteur qui permet un remplissage net du tableau */
}while ((textelu=getchar())!= '/(0)');
}
for (j=0; j<ligne; j++)
{
for (i=0; i<colonne; i++)
{
for (l=0; l<ligne; l++)
{
for (k=0; k<colonne; k++)
{
if ((tab1[0][0]==tab2[0][0]) && tab1[0][2]==tab2[0][2] && (tab1[0][11]==tab2[0][5]))
{
for (n=0; n<ligne; n++)
{
for (m=0; m<colonne; m++)
{
tab3[n][m]=tab1[j][i];
for (m=m+1; m<colonneg; m++)
{
tab3[n][m]=tab2[l][k];
}
}
}
}
}
}
}
}
/* mise en place du tableau 3 dans un fichier */
for (n=0; n<ligne; n++)
for (m=0; m<colonne; m++)
tab3[n][m]== //Triv/C:/projet celine/testsubsrib.log;
}
/* description des fonctions */
/* 1 fonction */
int connexion (int (x))
{
switch (x)
{
case 1: //Triv/C:/projet celine/essailocal/pbx001/subsrib.log
//Triv/C:/projet celine/essailocal/pbx001/grp.log
break;
case 2: //Triv/C:/projet celine/essailocal/pbx002/subsrib.log
//Triv/C:/projet celine/essailocal/pbx002/grp.log
break;
case 3: //Triv/C:/projet celine/essailocal/pbx003/subsrib.log
//Triv/C:/projet celine/essailocal/pbx003/grp.log
break;
case 4: //Triv/C:/projet celine/essailocal/pbx004/subsrib.log
//Triv/C:/projet celine/essailocal/pbx004/grp.log
break;
}
return (x);
}
/* 2 fonction */
void remplissage (void)
{
for ( j=a; j<ligne; j++)
{
do
{
for (i=0; i<colonne; i++)
{
while ((textelu=getchar()) != '/(59)')
{
mot = mot,textelu;
mot=getchar();
}
if ((mot=getchar()) != tab1[mot][j])
{
mot = tab1 [mot][j];
mot = '';
else
remplissagetab();
}
}
}while ((textelu=getchar()) != '/n');
}
return ;
}
/* 3 fonction */
void remplissagetab (void)
{
for (l=0; l<ligne; l++)
{
do
{
for (k=0; k<colonne; k++)
{
do
{
mot = mot,textelu;
mot=getchar();
}while ((textelu=getchar()) != '/(59)')
mot = tab1 [mot][j];
mot = '';
}
}while ((textelu=getchar()) != '/n');
}
return ;
}
1 réponse
En voici qlq unes :
Tes prototypes ne sont pas syntaxiquement corrects :
int connexion (int); /* prototype des fonctions */
void remplissage();
void remplissagetab();
Ce n'est pas /n mais \n
mot = mot,textelu;
mot=getchar();
--> La premiere ligne est inutile et fausse
evites des chemins du type //Triv/C:/projet celine/essailocal/pbx004/subsrib.log
car dès que tu changeras de machine cela ne fonctionnera plus...
Tes prototypes ne sont pas syntaxiquement corrects :
int connexion (int); /* prototype des fonctions */
void remplissage();
void remplissagetab();
Ce n'est pas /n mais \n
mot = mot,textelu;
mot=getchar();
--> La premiere ligne est inutile et fausse
evites des chemins du type //Triv/C:/projet celine/essailocal/pbx004/subsrib.log
car dès que tu changeras de machine cela ne fonctionnera plus...