De l'aide svp

talia2012 Messages postés 1 Date d'inscription vendredi 8 juin 2007 Statut Membre Dernière intervention 17 juin 2008 - 17 juin 2008 à 17:34
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 - 18 juin 2008 à 17:52
bonjour je propramme en visual C++ , j'ai plein d'erreurs que je n'arrive pas a enlever.

merci d'avance de votre aide

ps: je ss un débutant, je ss assez novice en la matière.

voici le code source
______________________________________________________________________________________
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define TAILLE_MAX 200




//déclaration des six fonctions utilisées
extern int FJPS (int tpi, int* p, int [4][200]);
extern int* Creer(int* P, int i, int [4][200]);
extern int* Union(int*U, int i);
extern int* Moins(int*U, int i);
extern int Tache_a_affecter (int* UR, int t, int* [4][200]);
extern int Min_ri (int* UR, int [4][200]);


//déclaration des trois procédures utilisées
void QuasiJPS (int [4][200]);
void JPSameliorer (int [4][200]);
extern int remplir_tab_tache(int* TAB_tache);


/*
extern int Min_ri(int*,int [] [200]);
extern int tache_a_affecter(int*,int*,int);
extern int remplir_tab_tache(int [] [200]);
extern int* Creer (int *P, int i, int *TAB_tache);
*/




int main()
{ int i,j;
 /*
 int taille_tab_tache; int ordonnancement[500];
int i; int U [TAILLE_MAX];int taille_U; int UR [TAILLE_MAX]; int taille_UR;int t,ti,x;
        //type_prio: 0:egale,1:dif,2:tres diff
// int remplir_tab_tache(TAB_tache);
//TAB_tache [ligne][colonne]
//remplissage de la table des tâches*/




  int TAB_tache[4][200];
  for (i=0, i<=199; i++;)
   for (j=0, j<=3; j++;)
   {
    TAB_tache[j][i]=0;
   }




TAB_tache[0][0]=1;
TAB_tache[0][1]=2;
TAB_tache[0][2]=3;
TAB_tache[0][3]=4;


TAB_tache[1][0]=4;
TAB_tache[1][1]=5;
TAB_tache[1][2]=7;
TAB_tache[1][3]=6;


TAB_tache[2][0]=7;
TAB_tache[2][1]=5;
TAB_tache[2][2]=2;
TAB_tache[2][3]=14;


TAB_tache[3][0]=13;
TAB_tache[3][1]=16;
TAB_tache[3][2]=18;
TAB_tache[3][3]=24;


/*
taille_tab_tache=4;
taille_UR=taille_tab_tache;
taille_U=0;
t=Min_ri(UR,TAB_tache);


while(taille_UR!=0)
{
i=tache_a_affecter(UR,ordonnancement,t);
ordonnancement[t]=i;


U[i-1]=i;
taille_U++;
UR[i-1]=0;
taille_UR--;
ti=t;
x=Min_ri(UR,TAB_tache);
if(ti+TAB_tache[2][i-1]<=x)
       t=x;
else
 {t=x;
 TAB_tache[2][i-1]=TAB_tache[2][i-1]-(x-ti);
 }
UR[i-1]=i;
taille_UR++;
U[i-1]=0;
taille_U--;
}
*/
QuasiJPS(TAB_tache);
JPSameliorer(TAB_tache);




return(0);
}


// La fonction Min_ri
int Min_ri(int* UR,int* TAB_tache);
{
int min; int x;


min=65000;
for (i=0, i<=199, i++)
{
 if (UR[i]!=0)
 {
  x=UR[i];
  if (TAB_tache[2][x-1]<min) min=TAB_tache[2][x-1];
 } 


}


return(min);


}




//l'algorithme Quasi-JPS
void QuasiJPS(int* TAB_tache)
{
 int* U[200]; int UR[200]; int Ord[65000]; int x,i,j,pi,ti,t; bool sortir;
 for (i=0, i<=199; i++;)
 {
  U[i]=0; UR[i]=TAB_tache[0][i];
 }
 t=Min_ri(UR,TAB_tache);
 for (i=0, i<=64999;i++;)
 {
  Ord[i]=0;
 }
 sortir=false;
 while (sortir=false)
 {
 i=Tache_a_affecter(UR, t, TAB_tache);
 U=Union(U,i); UR=Moins(UR,i); ti=t; t=Min_ri(UR, TAB_tache);
 if (ti+TAB_tache[1][i-1]>Min_ri(UR, TAB_tache))
 {
  x=Min_ri(UR, TAB_tache)-ti;
  for (j=ti, j<=ti+x; j++;)
  {
   Ord[j]=i;
  }
  TAB_tache[1][i-1]=TAB_tache[1][i-1]-(Min_ri(UR,TAB_tache)-ti);
  UR=Union(UR,i); U=Moins(U,i);
 }
 else
 {
 for (j=ti, j<=ti+pi; j++;)
 {
 Ord[j]=i;
 }
 }
 sortir=true;
 for (j=0, j<=199; j++;)
 {
  if (UR[j]!=0){sortir=false;}
 }


 }


}


 


// l'algorithme JPSameliorer
void JPSameliorer( int* TAB_tache)
{
 int* U[200]; int UR[200]; int Ord[65000]; int Dep,x,pi,i,j,ti,t; bool sortir;
 for (i=0, i<=199; i++;)
 {
  U[i]=0; UR[i]=TAB_tache[0][i];
 }
 t=Min_ri(UR,TAB_tache);
 for (i=0, i<=64999;i++;)
 {
  Ord[i]=0;
 }
 sortir=false;
 while (sortir=false)
 {
  i=Tache_a_affecter(UR, t, TAB_tache);
  for (j=0, j<=199; j++;)
  {
   P[j]=0;
  }
  P=Creer(P,i,TAB_tache); pi=TAB_tache[1][i-1];
  Dep=FJPS(t+pi),P,TAB_tache);
  if(Dep<=0)
  {
   for (j=t, j<=t+pi; j++;)
   {
    Ord[j]=i;
   }
   t=t+pi; U=Union(U,i); UR=Moins(UR,i);
  }
  else
  {
    for (j=t, j<=t+pi-Dep; j++;)
 {
  Ord[j]=i;
 }
 t=t+pi-Dep;  TAB_tache[1][i-1]=Dep;
  }
  sortir=true;
  for (j=0, j<=199; j++;)
  {
   if (UR[j]!=0) {sortir=false;}
  }
 }




}


 


 


 




/*
//déclarer TAB_tache [4][200]; int x;  déclarer U[200]; déclarer UR[200]; déclarer Ord[65000];


//initialisé U et UR et t


for (i=0, i<=199, i++)
{
  U[i]=0; UR[i]=TAB_tache=TAB_tache [0][i];
}
t=Min_ri(UR);
 
for (i=0, i<=64999, i++)
{
  Ord[i]=0;
}
i=Tache_a_affecter(UR, t, TAB_tache);
U=Union(U,i);  UR=Moins(UR,i), ti=t; t=Min_ri(UR);
if (ti+pi> Min_ri(UR))
{
   x=Min_ri(UR)-ti;
 for (j=ti, j<=ti+x, j++)
   {
     Ord[j]=i;
   }
    pi=pi-(Min_ri(UR)-ti);
 UR=Union(UR,i); U=Moins(U,i);
}
else
{
  for (j=ti, j<=ti+pi, j++)
  {
    Ord[j]=i;
  }
}


*/


//la fonction Union qui sert a rajouté une tache i dans un ensemble U
int* Union(int* U, int i)
{
 bool B; int j; B=false; j=0;
 while (B=false, j<=199)
 {
  if (U[j]==0) {U[j]=i; B=true;}
  else j++;
 }
 return (U);
}


 


// La fonction Min_ri
int Min_ri(int* UR,int TAB_tache);
{
int min; int x;


min=65000;
for (i=0, i<=199, i++)
{
 if (UR[i]!=0)
 {
  x=UR[i];
  if (TAB_tache[2][x-1]<min) min=TAB_tache[2][x-1];
 } 


}


return(min);


}


 


//la fonction Moins qui sert a enlever une tache i dans un ensemble U


int* Moins(int* U, int i)
{
 bool B; int j,k; B=false; j=0;
 while (B=false, j<=199)
 {
  if (U[j]!=0) {j++;}
  else
  {
   B=true;
   for (k=j, k<=198; k++;)
   {
     U[k]=U[k+1];
   }
  }
 }
 return (U);
}


 


//la fonction FJPS nous a tester la faisabillité avec l'algo JPS et nous donne en sortie le plus ecart sur les di
int FJPS (int tpi, int* P, int TAB_tache)
{
 int x; int* UR; int* U; int i,j; int ti; int t; bool sortir;
 int TAB_prov [4] [200];
 for (i=0, i<=199; i++;)
 {
  U[i]=0; UR[i]=P[i];
 }
 x=0;
 for (i=0, i<=199; i++;)
  for (j=0, j<=3; j++;)
  {
   TAB_prov[j][i]=TAB_tache[j][i];
  }
 sortir=false;
 
  if (tpi>= Min_ri(P, TAB_tache))
  {
   t=tpi;
  }
  else
  {
   t=Min_ri(P,TAB_tache);
  }
 while (sortir=false)
 {
  i=Tache_a_affecter (P, t, TAB_prov);
  U=Union (U,i); UR=Moins(UR,i); ti=t; t=Min_ri(UR,TAB_prov);
  if (ti+TAB_prov[1][i-1]>Min_ri(UR,TAB_tache))
  {
   TAB_prov[1][i-1]=TAB_prov[1][i-1]-(Min_ri(UR, TAB_prov)-ti);
   UR=Union(UR,i); U=Moins(U,i);
  }
  else if(ti+TAB_prov[1][i-1]>TAB_prov[3][i-1])
  {
   if (ti+TAB_prov[1][i-1]-TAB_prov[3][i-1]>x)
   {
    x=ti+TAB_prov[1][i-1]-TAB_prov[3][i-1];
   }
  }
  sortir=true;
  for (j=0, j<=199; j++;)
  {
   if (UR[j]!=0){sortir=false;}
  }
 }
 return(x);


}


 




// la fonction Creer P l'ensemble sur lequel tester la faisabilité 
int* Creer (int *P, int i, int *TAB_tache)
{ bool B; int j,k;
for (j=0, j<=199; j++;)
{
 if(j!=i)
 {
  if (TAB_tache[3][j-1]<TAB_tache[3][i-1])
  {
   B=false; k=0;
   while (B=false, k<=199)
   {
    if(P[k]==0)
 {
  P[k]=TAB_tache[3][j-1];
  B=true;
 }
 else {k++;}
   }


  }
 }


return(P);
};


 


//La fonction Tache_a_affecter




int Tache_a_affecter(int* UR, int t, int *Tab_tache)
{
 int min, int tache, int tache_min; bool B;
 min=65000, tache_min=0;
 
 for(i=0, i<=199; i++;)
 {
  if (UR[i] !=0)
  {
    tache=UR[i]-1;
    if (TAB_tache[2][tache]<=t)
     if (TAB_tache[3][tache]<min)
     {
       min=TAB_tache[3][tache];
    tache_min=TAB_tache[0][tache];
     }
     else if(TAB_tache[3][tache]=min)
     {
       B=false;
    for(i=0, i<=64999; i++;)
    {
      if (Ord[i]==Tab_tache[0][tache]) B=true;


    }
    if (B==true)
    {
     tache_min=Tab_tache[0][tache];
     min=Tab_tache[3][tache];
    }
     }
  }


 
 }
 return(tache_min);
}


_____________________________________________________________________________________

et voici les message d'erreurs

____________________________________________________________________________________
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(105) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(130) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(140) : error C2664: 'Tache_a_affecter' : cannot convert parameter 3 from 'int *' to 'int *[][200]'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(141) : error C2664: 'Union' : cannot convert parameter 1 from 'int *[200]' to 'int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(141) : error C2440: '=' : cannot convert from 'int *' to 'int [200]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(142) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(149) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(149) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(149) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(150) : error C2440: '=' : cannot convert from 'int *' to 'int [200]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(150) : error C2664: 'Moins' : cannot convert parameter 1 from 'int *[200]' to 'int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(177) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(187) : error C2664: 'Tache_a_affecter' : cannot convert parameter 3 from 'int *' to 'int *[][200]'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(190) : error C2065: 'P' : undeclared identifier
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(190) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(190) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(192) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(193) : error C2660: 'FJPS' : function does not take 1 parameters
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(193) : error C2059: syntax error : ')'
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(200) : error C2664: 'Union' : cannot convert parameter 1 from 'int *[200]' to 'int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(200) : error C2440: '=' : cannot convert from 'int *' to 'int [200]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(208) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(208) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(280) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(335) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(335) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(349) : error C2664: 'Tache_a_affecter' : cannot convert parameter 3 from 'int [4][200]' to 'int *[][200]'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(383) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(383) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(390) : error C2109: subscript requires array or pointer type
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(408) : error C2601: 'Tache_a_affecter' : local function definitions are illegal
C:\Documents and Settings\DIFALLAH Ramzi\Bureau\ramzi.CPP(447) : fatal error C1004: unexpected end of file found
Error executing cl.exe.


ramzi.obj - 32 error(s), 0 warning(s)
____________________________________________________________________________________________




 

2 réponses

Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 41
17 juin 2008 à 19:01
Déplacé sur cppfrance.com.

csharpfr.com != cppfrance.com
0
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
18 juin 2008 à 17:52
Hello,
Il y a un souci dans le prototype de la fonction Tache_a_affecter: pour le dernier paramètre, tu ne voulais pas mettre plutôt int[4][200] (c'est-à-dire sans étoile)?

Buno
----------------------------------------
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
Le site de mon mariage
0
Rejoignez-nous