Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : de l'aide svp [ Divers / Général ] (talia2012)

mardi 17 juin 2008 à 17:34:31 | de l'aide svp

talia2012

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)
____________________________________________________________________________________________


 


mardi 17 juin 2008 à 19:01:44 | Re : de l'aide svp

Lutinore

Administrateur CodeS-SourceS
Déplacé sur cppfrance.com.

csharpfr.com != cppfrance.com

mercredi 18 juin 2008 à 17:52:44 | Re : de l'aide svp

buno

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



Cette discussion est classé dans : int, tache, tab, ur, ramzi


Répondre à ce message

Sujets en rapport avec ce message

lire dans un fichier [ par skeul ] Bonjour,je rencontre qqs difficultés a faire une fonction qui lit un fichier et qui rentre la chaine de caractere dans un tableauy a comme un probleme Pb Tableaux et initialisation. [ par AstraDeon ] Bonjour,Voila je tentais une simple initinitialisation d'un tableau bidimensionnel, mais j'ai pas le resultat escomptsS, voici le code :#include int m fonction d'alloaction dynamique [ par tomsawyerbelgique ] Pour une allocation dynamique d'un tableau à deux dimensions. Comme celle ci:cout // Initalisation int** tab = new int*[p_size1_tab]; for(in Blem Somme ELmt d'un Tableau Bidimensionnel [ par Orezza ] Slt c encore moi, le boulet de l'info...c tjrs le meme prog mais cette fois ci j'aimerais afficher la somme des elmts de mon tableaux.#include #includ Mais Pkoi un erreur ?! [ par Orezza ] OrezzaBonjour voila encore une de mes sources Bidon, je le sais je debute mais pkoi mon compilateur indique une erreur je ne vois vraiment pas.je vous tableau char [ par dingue007 ] Voila je dois faire un prog en C++ : un tableau avec les mois de lannée et quand je tape un chiffre il me sort le mois ! mais je narrive pas a faire l Mon code ne marche pô ! [ par xavier59 ] Mon code ne marche pas !Merci de m'aider !!!**************************************************# include # include int main(){ int tab[5]; int i; int t GetAsyncKeyState [ par sebleboss2002 ] Bon, c'est encore moi, ce coup-ci, j'ai trouvé (plus ou moins) comment faire ce que je voulais :#include #include <br Renvoie de type int& [ par saturne_1606 ] Bonjour a tous!Voila g la fonction suivante:int& tableau::operator ()(int l, int c){ if ((l>=tab.size())||(c>=(tab[l]).size())) { pb avec fonctions sqrt de math.h [ par fox88 ] voici mon code : void histod::calcul_moyenne_ecartype(){ //CALCUL MOYENNE DU NB D'APPELS MOYEN JOURNALIER unsigned long accu=0; int moyenne=0;<br


Nos sponsors

Sondage...

CalendriCode

Décembre 2008
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,234 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.