talia2012
Messages postés1Date d'inscriptionvendredi 8 juin 2007StatutMembreDernière intervention17 juin 2008
-
17 juin 2008 à 17:34
BunoCS
Messages postés15475Date d'inscriptionlundi 11 juillet 2005StatutModérateurDernière intervention23 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.
//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;
}
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];
}
}
}
____________________________________________________________________________________
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.
BunoCS
Messages postés15475Date d'inscriptionlundi 11 juillet 2005StatutModérateurDernière intervention23 avril 2024103 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