Des warning en code C
nwiwla.cbn
Messages postés
5
Date d'inscription
Statut
Membre
Dernière intervention
-
Marco la baraque Messages postés 996 Date d'inscription Statut Contributeur Dernière intervention -
Marco la baraque Messages postés 996 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
j'ai un problème dans mon code je vous le passe,
/*******************************************
MSP pour TI89
Quelques déclarations :
n : taille d'un échantillon 1 < n < NMAX+1
m : nombre d'échantillon
R : moyenne de toutes les ?tendues
R_ech : étendue d'un échantillon
X : moyenne de tous les échantillons
X_ech : moyenne d'un échantillon
*******************************************/
#include <tigcclib.h>
#define NMAX 15 // taille maximum des échantillons
#define TRUE 1
#define FALSE 0
float a2[NMAX] = { 0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223} ;
float d2[NMAX] = { 0, 1.128, 1.693, 2.059, 2.326, 2.534, 2.704, 2.847, 2.97, 3.078, 3.173, 3.258, 3.336, 3.407, 3.472 } ;
float d3[NMAX] = { 0, 0, 0, 0, 0, 0, 0.076, 0.136, 0.178, 0.223, 0.256, 0.283, 0.307, 0.328, 0.347 } ;
float d4[NMAX] = { 0, 3.267, 2.574, 2.282, 2.114, 2.004, 1.924, 1.864, 1.816, 1.777, 1.744, 1.717, 1.693, 1.672, 1.653 } ;
float sum_R = 0, sum_X = 0, Xmini = 1000000, Xmaxi = 0, USL, LSL, IT ;
float UX, LX, UR, LR, X, R ;
float Rdata[NMAX], Xdata[NMAX] ;
int n = 0, m = 0, AUTL = 0, BLTL = 0 ;
char *nom_fichier = NULL ;
/*******************************************************
Maximum entre deux entiers a et b
*******************************************************/
float maxi(float a, float b)
{
if (a > b) return (a);
else return (b);
}
/*******************************************************
Minimum entre deux entier a et b
*******************************************************/
float mini(float a, float b)
{
if (a < b) return (a);
else return (b);
}
/*******************************************************
Valeur absolue d'un nombre réel
*******************************************************/
float absf(float val)
{
if (val>0) return (val) ;
else return (-val) ;
}
/*******************************************************
Introduction des valeurs d'un nouveau échantillon
*******************************************************/
void nouveau()
{
float R_ech, sum_ech = 0 ;
float X_ech_mini = 1000000, X_ech_maxi = 0, plop ;
float Xval[NMAX] ;
int i, AUTL_ech = 0, BLTL_ech = 0 ;
char choix ;
clrscr() ;
printf("Sample n°%d'n",m+1) ;
for (i=0; i<n; i++)
{
printf("'nInput data n°%d : ",i+1) ;
scanf("%f",&plop) ;
Xval[i] = plop ;
X_ech_maxi = maxi(plop,X_ech_maxi) ;
X_ech_mini = mini(plop,X_ech_mini) ;
sum_ech = sum_ech + plop ;
if (plop>USL)
AUTL_ech++ ;
if (plop<LSL)
BLTL_ech++ ;
}
R_ech = X_ech_maxi-X_ech_mini ;
clrscr() ;
printf("Sample n°%d'n",m+1) ;
printf("Xmaxi : %.3f",X_ech_maxi ) ;
printf("'nXmini : %.3f",X_ech_mini ) ;
printf("'nX[%d] : %.3f",m+1,sum_ech/n) ;
printf("'nR[%d] : %.3f",m+1,R_ech ) ;
printf("'n%d > USL",AUTL_ech) ;
printf("'n%d < LSL",BLTL_ech) ;
printf("'n'nSave datas Y/N ?") ;
choix = tolower(ngetchx()) ;
if (choix == 'y')
{
m = m+1 ;
sum_X = sum_X + sum_ech ;
sum_R = sum_R + R_ech ;
Xmaxi = maxi(X_ech_maxi,Xmaxi) ;
Xmini = mini(X_ech_mini,Xmini) ;
X = sum_X/(m*n) ;
R = sum_R/m ;
UX = X+a2[n-1]*R ;
LX = X-a2[n-1]*R ;
UR = d4[n-1]*R ;
LR = d3[n-1]*R ;
AUTL = AUTL+AUTL_ech ;
BLTL = BLTL+BLTL_ech ;
if (m<=NMAX)
{
Xdata[m-1] = sum_ech/n ;
Rdata[m-1] = R_ech ;
}
else
{
for(i=0 ; i<NMAX-1 ; i++)
{
Xdata[i] = Xdata[i+1] ;
Rdata[i] = Rdata[i+1] ;
}
Xdata[NMAX-1] = sum_ech/n ;
Rdata[NMAX-1] = R_ech ;
}
}
}
/*******************************************************
Affichage des données statistiques
*******************************************************/
void data()
{
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
printf("m : %d'n",m) ;
printf("n : %d'n",n) ;
printf("X : %.3f'n",X) ;
printf("R : %.3f'n",R) ;
printf("LSL : %.3f'n",LSL) ;
printf("USL : %.3f'n",USL) ;
printf("USL-LSL : %.3f'n",IT) ;
printf("Xmaxi : %.3f'n",Xmaxi) ;
printf("Xmini : %.3f'n'n",Xmini) ;
printf("Press a key") ;
ngetchx() ;
}
/*******************************************************
Affichage des limites de contrôle
*******************************************************/
void limites()
{
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
printf("UX : %.3f'n",UX) ;
printf("LX : %.3f'n'n",LX) ;
printf("UR : %.3f'n",UR) ;
printf("LR : %.3f'n",LR) ;
printf("'nPress a key") ;
ngetchx() ;
}
/*******************************************************
Calcul des capabilités Cm et Cmk
*******************************************************/
void capabilites()
{
float S ;
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
S = R/d2[n-1] ;
printf("Cp : %.3f'n'n",IT/(6*S)) ;
printf("Cpk : %.3f'n'n",mini(absf(USL-X),absf(X-LSL))/(3*S)) ;
printf("%.01f",100.*AUTL/(m*n)) ;
putchar('37) ;
printf(" > USL'n'n") ;
printf("%.01f",100.*BLTL/(m*n)) ;
putchar('37) ;
printf(" < LSL'n'n") ;
printf("'n'nPress a key") ;
ngetchx() ;
}
/*******************************************************
Lecture à partir d'un fichier
*******************************************************/
void lecture(char *nom_f)
{
FILE *fichier ;
int i, lim ;
if ((fichier = fopen(nom_f,"r")) == NULL)
{
printf("'nReading error for open %s'n",nom_f);
exit(1) ;
}
fscanf(fichier,"%d",&m) ;
fscanf(fichier,"%d",&n) ;
fscanf(fichier,"%f",&USL) ;
fscanf(fichier,"%f",&LSL) ;
fscanf(fichier,"%f",&IT) ;
fscanf(fichier,"%f",&sum_X) ;
fscanf(fichier,"%f",&sum_R) ;
fscanf(fichier,"%f",&Xmini) ;
fscanf(fichier,"%f",&Xmaxi) ;
fscanf(fichier,"%d",&AUTL) ;
fscanf(fichier,"%d",&BLTL) ;
X = sum_X/(m*n) ;
R = sum_R/m ;
UX = X+a2[n-1]*R ;
LX = X-a2[n-1]*R ;
UR = d4[n-1]*R ;
LR = d3[n-1]*R ;
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
for(i=0 ; i<lim ; i++)
{
fscanf(fichier,"%f",&Xdata[i]) ;
fscanf(fichier,"%f",&Rdata[i]) ;
}
fclose(fichier) ;
}
/*******************************************************
Sauvegarde dans un fichier
*******************************************************/
void sauvegarde(char *nom_f)
{
FILE *fichier ;
int i, lim ;
if ((fichier = fopen(nom_f,"w")) == NULL)
{
printf("'nWriting error for file %s'n",nom_f);
exit(1) ;
}
fprintf(fichier,"%d'n",m) ;
fprintf(fichier,"%d'n",n) ;
fprintf(fichier,"%f'n",USL) ;
fprintf(fichier,"%f'n",LSL) ;
fprintf(fichier,"%f'n",IT) ;
fprintf(fichier,"%f'n",sum_X) ;
fprintf(fichier,"%f'n",sum_R) ;
fprintf(fichier,"%f'n",Xmini) ;
fprintf(fichier,"%f'n",Xmaxi) ;
fprintf(fichier,"%d'n",AUTL) ;
fprintf(fichier,"%d'n",BLTL) ;
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
for(i=0 ; i<lim ; i++)
fprintf(fichier,"%f %f'n",Xdata[i],Rdata[i]) ;
fclose(fichier) ;
}
/****************************************************************
Procédure d'affichage des cartes de contrôle
****************************************************************/
void charts ()
{
static WIN_RECT rect = {15, 10, 150, 80};
int i, lim ;
char chain[30] ;
if (m < 2)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
sprintf(chain,"m = %d n = %d",m,n) ;
clrscr() ;
DrawClipRect (&rect, ScrRect, A_THICK1);
DrawLine (15,45,150,45,A_THICK1) ;
DrawLine (15,22,150,22,A_NORMAL) ;
DrawLine (15,33,150,33,A_NORMAL) ;
DrawLine (15,57,150,57,A_NORMAL) ;
DrawLine (15,68,150,68,A_NORMAL) ;
FontSetSys (F_6x8);
DrawStr (0, 7, "Ux", A_NORMAL);
DrawStr (0, 77, "Lx", A_NORMAL);
DrawStr (0, 43, "X", A_NORMAL);
DrawStr (55, 85, "X Chart", A_NORMAL);
DrawStr (47, 1, chain, A_NORMAL);
for(i=0 ; i<lim-1 ; i++)
DrawLine (15+i*9, 10+(UX-Xdata[i])/(UX-LX)*70, 15+(i+1)*9, 10+(UX-Xdata[i+1])/(UX-LX)*70, A_NORMAL);
ngetchx() ;
clrscr() ;
DrawClipRect (&rect, ScrRect, A_THICK1);
DrawLine (15,10+(UR-R)/(UR-LR)*70, 150,10+(UR-R)/(UR-LR)*70, A_THICK1) ;
FontSetSys (F_6x8);
DrawStr (0, 7, "UR", A_NORMAL);
DrawStr (0, 77, "LR", A_NORMAL);
DrawStr (0, 8+(UR-R)/(UR-LR)*70, "R", A_NORMAL);
DrawStr (55, 85, "R Chart", A_NORMAL);
DrawStr (47, 1, chain, A_NORMAL);
for(i=0 ; i<lim-1 ; i++)
DrawLine (15+i*9, 10+(UR-Rdata[i])/(UR-LR)*70, 15+(i+1)*9, 10+(UR-Rdata[i+1])/(UR-LR)*70, A_NORMAL);
FontSetSys (F_6x8);
ngetchx() ;
}
/****************************************************************
Procédure d'affichage du crédit
****************************************************************/
void about ()
{
static WIN_RECT rect = {0, 0, 158, 91};
clrscr() ;
FontSetSys (F_6x8);
DrawStr (30, 4, "SPC89 V1.0 BETA", A_NORMAL);
FontSetSys (F_4x6);
DrawStr (70, 14, "By", A_NORMAL);
DrawStr (50, 27, "Laurent Damay", A_NORMAL);
DrawStr (20, 42, "Université de Picardie Jules Vernes", A_NORMAL);
DrawStr (55, 57, "IUT de l'Aisne", A_NORMAL);
DrawStr (30, 72, "laurent.damay@u-picardie.fr", A_NORMAL);
DrawStr (35, 84, "www.iut-aisne.fr/webogp/", A_NORMAL);
DrawClipRect (&rect, ScrRect, A_THICK1);
FontSetSys (F_6x8);
ngetchx() ;
}
/****************************************************************
Boucle principale
****************************************************************/
void _main()
{
char chaine ;
short choix ;
int argtype ;
ESI argptr;
InitArgPtr (argptr);
if ((argtype = GetArgType (argptr)) != END_TAG)
{
if (argtype == STR_TAG)
{
nom_fichier = GetStrnArg (argptr) ;
lecture(nom_fichier) ;
}
else
{
clrscr() ;
printf("Bad Data'n'nPress a Key");
ngetchx() ;
exit(1) ;
}
}
else
{
clrscr() ;
printf("Input n : 'n") ;
scanf("%d",&n) ;
if ((n<2) || (n>NMAX))
{
printf("'nError : 2 =< n =< %d'n'n",NMAX) ;
printf("Press a key'n") ;
ngetchx() ;
exit(1) ;
}
printf("'nInput LSL : ") ;
scanf("%f",&LSL) ;
printf("'nInput USL : ") ;
scanf("%f",&USL) ;
if (USL<=LSL)
{
printf("'nError : USL > LSL'n'n") ;
printf("Press a key'n") ;
ngetchx() ;
exit(1) ;
}
IT = USL - LSL ;
}
do
{
clrscr() ;
printf("SPC89 V1.0 BETA'n'n") ;
printf("1) Add sample'n2) X R Xmini Xmaxi'n3) LX UX LR UR'n4) Cp Cpk'n5) X, R Charts'n6) About'nESC) Quit'n? ") ;
choix = ngetchx() ;
switch(choix)
{
case '1' :
{
nouveau() ;
break ;
}
case '2' :
{
data() ;
break ;
}
case '3' :
{
limites() ;
break ;
}
case '4' :
{
capabilites() ;
break ;
}
case '5' :
{
charts() ;
break ;
}
case '6' :
{
about() ;
break ;
}
case KEY_ESC : break ;
}
}
while (choix != KEY_ESC) ;
if (m > 0)
{
if (*nom_fichier == NULL)
{
printf("'n'nInput name of file 'n") ;
scanf("%s",&chaine) ;
nom_fichier = &chaine ;
}
sauvegarde(nom_fichier) ;
}
}
les warningsont:
Multi-character constant deux fois
assignment discards qualifiers from pointer target type
comparaison between pointer and integer
aider moi c'est urgent,
merci infiniment
j'ai un problème dans mon code je vous le passe,
/*******************************************
MSP pour TI89
Quelques déclarations :
n : taille d'un échantillon 1 < n < NMAX+1
m : nombre d'échantillon
R : moyenne de toutes les ?tendues
R_ech : étendue d'un échantillon
X : moyenne de tous les échantillons
X_ech : moyenne d'un échantillon
*******************************************/
#include <tigcclib.h>
#define NMAX 15 // taille maximum des échantillons
#define TRUE 1
#define FALSE 0
float a2[NMAX] = { 0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223} ;
float d2[NMAX] = { 0, 1.128, 1.693, 2.059, 2.326, 2.534, 2.704, 2.847, 2.97, 3.078, 3.173, 3.258, 3.336, 3.407, 3.472 } ;
float d3[NMAX] = { 0, 0, 0, 0, 0, 0, 0.076, 0.136, 0.178, 0.223, 0.256, 0.283, 0.307, 0.328, 0.347 } ;
float d4[NMAX] = { 0, 3.267, 2.574, 2.282, 2.114, 2.004, 1.924, 1.864, 1.816, 1.777, 1.744, 1.717, 1.693, 1.672, 1.653 } ;
float sum_R = 0, sum_X = 0, Xmini = 1000000, Xmaxi = 0, USL, LSL, IT ;
float UX, LX, UR, LR, X, R ;
float Rdata[NMAX], Xdata[NMAX] ;
int n = 0, m = 0, AUTL = 0, BLTL = 0 ;
char *nom_fichier = NULL ;
/*******************************************************
Maximum entre deux entiers a et b
*******************************************************/
float maxi(float a, float b)
{
if (a > b) return (a);
else return (b);
}
/*******************************************************
Minimum entre deux entier a et b
*******************************************************/
float mini(float a, float b)
{
if (a < b) return (a);
else return (b);
}
/*******************************************************
Valeur absolue d'un nombre réel
*******************************************************/
float absf(float val)
{
if (val>0) return (val) ;
else return (-val) ;
}
/*******************************************************
Introduction des valeurs d'un nouveau échantillon
*******************************************************/
void nouveau()
{
float R_ech, sum_ech = 0 ;
float X_ech_mini = 1000000, X_ech_maxi = 0, plop ;
float Xval[NMAX] ;
int i, AUTL_ech = 0, BLTL_ech = 0 ;
char choix ;
clrscr() ;
printf("Sample n°%d'n",m+1) ;
for (i=0; i<n; i++)
{
printf("'nInput data n°%d : ",i+1) ;
scanf("%f",&plop) ;
Xval[i] = plop ;
X_ech_maxi = maxi(plop,X_ech_maxi) ;
X_ech_mini = mini(plop,X_ech_mini) ;
sum_ech = sum_ech + plop ;
if (plop>USL)
AUTL_ech++ ;
if (plop<LSL)
BLTL_ech++ ;
}
R_ech = X_ech_maxi-X_ech_mini ;
clrscr() ;
printf("Sample n°%d'n",m+1) ;
printf("Xmaxi : %.3f",X_ech_maxi ) ;
printf("'nXmini : %.3f",X_ech_mini ) ;
printf("'nX[%d] : %.3f",m+1,sum_ech/n) ;
printf("'nR[%d] : %.3f",m+1,R_ech ) ;
printf("'n%d > USL",AUTL_ech) ;
printf("'n%d < LSL",BLTL_ech) ;
printf("'n'nSave datas Y/N ?") ;
choix = tolower(ngetchx()) ;
if (choix == 'y')
{
m = m+1 ;
sum_X = sum_X + sum_ech ;
sum_R = sum_R + R_ech ;
Xmaxi = maxi(X_ech_maxi,Xmaxi) ;
Xmini = mini(X_ech_mini,Xmini) ;
X = sum_X/(m*n) ;
R = sum_R/m ;
UX = X+a2[n-1]*R ;
LX = X-a2[n-1]*R ;
UR = d4[n-1]*R ;
LR = d3[n-1]*R ;
AUTL = AUTL+AUTL_ech ;
BLTL = BLTL+BLTL_ech ;
if (m<=NMAX)
{
Xdata[m-1] = sum_ech/n ;
Rdata[m-1] = R_ech ;
}
else
{
for(i=0 ; i<NMAX-1 ; i++)
{
Xdata[i] = Xdata[i+1] ;
Rdata[i] = Rdata[i+1] ;
}
Xdata[NMAX-1] = sum_ech/n ;
Rdata[NMAX-1] = R_ech ;
}
}
}
/*******************************************************
Affichage des données statistiques
*******************************************************/
void data()
{
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
printf("m : %d'n",m) ;
printf("n : %d'n",n) ;
printf("X : %.3f'n",X) ;
printf("R : %.3f'n",R) ;
printf("LSL : %.3f'n",LSL) ;
printf("USL : %.3f'n",USL) ;
printf("USL-LSL : %.3f'n",IT) ;
printf("Xmaxi : %.3f'n",Xmaxi) ;
printf("Xmini : %.3f'n'n",Xmini) ;
printf("Press a key") ;
ngetchx() ;
}
/*******************************************************
Affichage des limites de contrôle
*******************************************************/
void limites()
{
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
printf("UX : %.3f'n",UX) ;
printf("LX : %.3f'n'n",LX) ;
printf("UR : %.3f'n",UR) ;
printf("LR : %.3f'n",LR) ;
printf("'nPress a key") ;
ngetchx() ;
}
/*******************************************************
Calcul des capabilités Cm et Cmk
*******************************************************/
void capabilites()
{
float S ;
if (m == 0)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
clrscr() ;
S = R/d2[n-1] ;
printf("Cp : %.3f'n'n",IT/(6*S)) ;
printf("Cpk : %.3f'n'n",mini(absf(USL-X),absf(X-LSL))/(3*S)) ;
printf("%.01f",100.*AUTL/(m*n)) ;
putchar('37) ;
printf(" > USL'n'n") ;
printf("%.01f",100.*BLTL/(m*n)) ;
putchar('37) ;
printf(" < LSL'n'n") ;
printf("'n'nPress a key") ;
ngetchx() ;
}
/*******************************************************
Lecture à partir d'un fichier
*******************************************************/
void lecture(char *nom_f)
{
FILE *fichier ;
int i, lim ;
if ((fichier = fopen(nom_f,"r")) == NULL)
{
printf("'nReading error for open %s'n",nom_f);
exit(1) ;
}
fscanf(fichier,"%d",&m) ;
fscanf(fichier,"%d",&n) ;
fscanf(fichier,"%f",&USL) ;
fscanf(fichier,"%f",&LSL) ;
fscanf(fichier,"%f",&IT) ;
fscanf(fichier,"%f",&sum_X) ;
fscanf(fichier,"%f",&sum_R) ;
fscanf(fichier,"%f",&Xmini) ;
fscanf(fichier,"%f",&Xmaxi) ;
fscanf(fichier,"%d",&AUTL) ;
fscanf(fichier,"%d",&BLTL) ;
X = sum_X/(m*n) ;
R = sum_R/m ;
UX = X+a2[n-1]*R ;
LX = X-a2[n-1]*R ;
UR = d4[n-1]*R ;
LR = d3[n-1]*R ;
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
for(i=0 ; i<lim ; i++)
{
fscanf(fichier,"%f",&Xdata[i]) ;
fscanf(fichier,"%f",&Rdata[i]) ;
}
fclose(fichier) ;
}
/*******************************************************
Sauvegarde dans un fichier
*******************************************************/
void sauvegarde(char *nom_f)
{
FILE *fichier ;
int i, lim ;
if ((fichier = fopen(nom_f,"w")) == NULL)
{
printf("'nWriting error for file %s'n",nom_f);
exit(1) ;
}
fprintf(fichier,"%d'n",m) ;
fprintf(fichier,"%d'n",n) ;
fprintf(fichier,"%f'n",USL) ;
fprintf(fichier,"%f'n",LSL) ;
fprintf(fichier,"%f'n",IT) ;
fprintf(fichier,"%f'n",sum_X) ;
fprintf(fichier,"%f'n",sum_R) ;
fprintf(fichier,"%f'n",Xmini) ;
fprintf(fichier,"%f'n",Xmaxi) ;
fprintf(fichier,"%d'n",AUTL) ;
fprintf(fichier,"%d'n",BLTL) ;
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
for(i=0 ; i<lim ; i++)
fprintf(fichier,"%f %f'n",Xdata[i],Rdata[i]) ;
fclose(fichier) ;
}
/****************************************************************
Procédure d'affichage des cartes de contrôle
****************************************************************/
void charts ()
{
static WIN_RECT rect = {15, 10, 150, 80};
int i, lim ;
char chain[30] ;
if (m < 2)
{
printf("'nNo data'n'n") ;
printf("Press a key") ;
ngetchx() ;
return ;
}
if (m<NMAX)
lim = m ;
else
lim = NMAX ;
sprintf(chain,"m = %d n = %d",m,n) ;
clrscr() ;
DrawClipRect (&rect, ScrRect, A_THICK1);
DrawLine (15,45,150,45,A_THICK1) ;
DrawLine (15,22,150,22,A_NORMAL) ;
DrawLine (15,33,150,33,A_NORMAL) ;
DrawLine (15,57,150,57,A_NORMAL) ;
DrawLine (15,68,150,68,A_NORMAL) ;
FontSetSys (F_6x8);
DrawStr (0, 7, "Ux", A_NORMAL);
DrawStr (0, 77, "Lx", A_NORMAL);
DrawStr (0, 43, "X", A_NORMAL);
DrawStr (55, 85, "X Chart", A_NORMAL);
DrawStr (47, 1, chain, A_NORMAL);
for(i=0 ; i<lim-1 ; i++)
DrawLine (15+i*9, 10+(UX-Xdata[i])/(UX-LX)*70, 15+(i+1)*9, 10+(UX-Xdata[i+1])/(UX-LX)*70, A_NORMAL);
ngetchx() ;
clrscr() ;
DrawClipRect (&rect, ScrRect, A_THICK1);
DrawLine (15,10+(UR-R)/(UR-LR)*70, 150,10+(UR-R)/(UR-LR)*70, A_THICK1) ;
FontSetSys (F_6x8);
DrawStr (0, 7, "UR", A_NORMAL);
DrawStr (0, 77, "LR", A_NORMAL);
DrawStr (0, 8+(UR-R)/(UR-LR)*70, "R", A_NORMAL);
DrawStr (55, 85, "R Chart", A_NORMAL);
DrawStr (47, 1, chain, A_NORMAL);
for(i=0 ; i<lim-1 ; i++)
DrawLine (15+i*9, 10+(UR-Rdata[i])/(UR-LR)*70, 15+(i+1)*9, 10+(UR-Rdata[i+1])/(UR-LR)*70, A_NORMAL);
FontSetSys (F_6x8);
ngetchx() ;
}
/****************************************************************
Procédure d'affichage du crédit
****************************************************************/
void about ()
{
static WIN_RECT rect = {0, 0, 158, 91};
clrscr() ;
FontSetSys (F_6x8);
DrawStr (30, 4, "SPC89 V1.0 BETA", A_NORMAL);
FontSetSys (F_4x6);
DrawStr (70, 14, "By", A_NORMAL);
DrawStr (50, 27, "Laurent Damay", A_NORMAL);
DrawStr (20, 42, "Université de Picardie Jules Vernes", A_NORMAL);
DrawStr (55, 57, "IUT de l'Aisne", A_NORMAL);
DrawStr (30, 72, "laurent.damay@u-picardie.fr", A_NORMAL);
DrawStr (35, 84, "www.iut-aisne.fr/webogp/", A_NORMAL);
DrawClipRect (&rect, ScrRect, A_THICK1);
FontSetSys (F_6x8);
ngetchx() ;
}
/****************************************************************
Boucle principale
****************************************************************/
void _main()
{
char chaine ;
short choix ;
int argtype ;
ESI argptr;
InitArgPtr (argptr);
if ((argtype = GetArgType (argptr)) != END_TAG)
{
if (argtype == STR_TAG)
{
nom_fichier = GetStrnArg (argptr) ;
lecture(nom_fichier) ;
}
else
{
clrscr() ;
printf("Bad Data'n'nPress a Key");
ngetchx() ;
exit(1) ;
}
}
else
{
clrscr() ;
printf("Input n : 'n") ;
scanf("%d",&n) ;
if ((n<2) || (n>NMAX))
{
printf("'nError : 2 =< n =< %d'n'n",NMAX) ;
printf("Press a key'n") ;
ngetchx() ;
exit(1) ;
}
printf("'nInput LSL : ") ;
scanf("%f",&LSL) ;
printf("'nInput USL : ") ;
scanf("%f",&USL) ;
if (USL<=LSL)
{
printf("'nError : USL > LSL'n'n") ;
printf("Press a key'n") ;
ngetchx() ;
exit(1) ;
}
IT = USL - LSL ;
}
do
{
clrscr() ;
printf("SPC89 V1.0 BETA'n'n") ;
printf("1) Add sample'n2) X R Xmini Xmaxi'n3) LX UX LR UR'n4) Cp Cpk'n5) X, R Charts'n6) About'nESC) Quit'n? ") ;
choix = ngetchx() ;
switch(choix)
{
case '1' :
{
nouveau() ;
break ;
}
case '2' :
{
data() ;
break ;
}
case '3' :
{
limites() ;
break ;
}
case '4' :
{
capabilites() ;
break ;
}
case '5' :
{
charts() ;
break ;
}
case '6' :
{
about() ;
break ;
}
case KEY_ESC : break ;
}
}
while (choix != KEY_ESC) ;
if (m > 0)
{
if (*nom_fichier == NULL)
{
printf("'n'nInput name of file 'n") ;
scanf("%s",&chaine) ;
nom_fichier = &chaine ;
}
sauvegarde(nom_fichier) ;
}
}
les warningsont:
Multi-character constant deux fois
assignment discards qualifiers from pointer target type
comparaison between pointer and integer
aider moi c'est urgent,
merci infiniment
A voir également:
- Des warning en code C
- Code ascii - Guide
- Code puk bloqué - Guide
- Comment déverrouiller un téléphone quand on a oublié le code - Guide
- Code activation windows 10 - Guide
- Code blocks - Télécharger - Langages
5 réponses
Bonsoir,
Ton code est un peu long à lire, je n'ai pas le courage (désolé...).
Tu peux indiquer à quel endroit apparaissent ces warnings stp ?
Merci
Ton code est un peu long à lire, je n'ai pas le courage (désolé...).
Tu peux indiquer à quel endroit apparaissent ces warnings stp ?
Merci
voila dans void capabilites() le premier putchar('37'); et meme chose le deuxième putchar('37');
le troisième warnin dans void main() nom_fichier=GetstrnARG(argptr);
le dernier warning= if (*nom_fichier == NULL)
merci pour le temps que tu me consacres j'aprecis
le troisième warnin dans void main() nom_fichier=GetstrnARG(argptr);
le dernier warning= if (*nom_fichier == NULL)
merci pour le temps que tu me consacres j'aprecis
Pour le problème avec les 2 putchar, c'est parce que la fonction putchar prend un char en argument, et toi tu ne lui donnes pas un char... Un char, comme son nom l'indique c'est un caractère, comme 'a', ou '3' ou n'importe quel caractère. '37' n'est pas un char.
Tu peux passer par le code ascii du caractère si tu veux.
Par exemple, si tu veux écrire le caractère %, tu peux faire :
putchar(37); ou putchar('%');
Pour le second warning, tu peux donner le code de ta fonction GetstrnARG stp?
Pour le dernier, ça devrait découler du second warning.
Tu peux passer par le code ascii du caractère si tu veux.
Par exemple, si tu veux écrire le caractère %, tu peux faire :
putchar(37); ou putchar('%');
Pour le second warning, tu peux donner le code de ta fonction GetstrnARG stp?
Pour le dernier, ça devrait découler du second warning.
excuse moi hier j'avais un problème de connexion,
pour le putchar ça marche bien, merci,
ils disent et pardon puisque je ne maitrise pas l'anglais:" GetStrnArg is a macro which returns the current string argument (pointed to by ap) and modifies ap to point to the next argument in the argument list. so, each successive time GetStrnArg is used, it returns the next argument in the argument list. ""
thank you for your help ;)
pour le putchar ça marche bien, merci,
ils disent et pardon puisque je ne maitrise pas l'anglais:" GetStrnArg is a macro which returns the current string argument (pointed to by ap) and modifies ap to point to the next argument in the argument list. so, each successive time GetStrnArg is used, it returns the next argument in the argument list. ""
thank you for your help ;)
et encore une autre chose il y a une fonction que j'ai utilisé c'est InitArgPtr
"
InitArgPtr is a macro which initializes ap (which is a pointer of type ESI) to point to the first argument passed to the assembly program. Principally, calling
InitArgPtr (argptr);
is equal to doing
argptr = top_estack;
See top_estack for more info.
InitArgPtr must be used before the first call to GetStrnArg etc. Here is an example of a program which reads string or integer arguments passed to it, and displays them on the screen, one by one (called "Argument Test"):
// An example of passing arguments to C program
// Try this program calling argtest(arg1,arg2,...)
#define USE_TI89
#define USE_TI92PLUS
#define USE_V200
#define MIN_AMS 100
#include <graph.h>
#include <printf.h>
#include <kbd.h>
#include <args.h>
void _main(void)
{
ESI argptr;
int argtype;
long num;
InitArgPtr (argptr);
while ((argtype = GetArgType (argptr)) != END_TAG)
{
DrawStr (0, 30, " ", A_REPLACE);
if (argtype == STR_TAG)
DrawStr (0, 30, GetStrnArg (argptr), A_REPLACE);
else if (argtype == POSINT_TAG || argtype == NEGINT_TAG)
{
num = GetIntArg (argptr);
if (argtype == NEGINT_TAG)
num = -num;
printf_xy (0, 30, "%ld", num);
}
else
{
DrawStr (0, 30, "Wrong arg type!", A_REPLACE);
ngetchx ();
break;
}
ngetchx ();
}
}
"
InitArgPtr is a macro which initializes ap (which is a pointer of type ESI) to point to the first argument passed to the assembly program. Principally, calling
InitArgPtr (argptr);
is equal to doing
argptr = top_estack;
See top_estack for more info.
InitArgPtr must be used before the first call to GetStrnArg etc. Here is an example of a program which reads string or integer arguments passed to it, and displays them on the screen, one by one (called "Argument Test"):
// An example of passing arguments to C program
// Try this program calling argtest(arg1,arg2,...)
#define USE_TI89
#define USE_TI92PLUS
#define USE_V200
#define MIN_AMS 100
#include <graph.h>
#include <printf.h>
#include <kbd.h>
#include <args.h>
void _main(void)
{
ESI argptr;
int argtype;
long num;
InitArgPtr (argptr);
while ((argtype = GetArgType (argptr)) != END_TAG)
{
DrawStr (0, 30, " ", A_REPLACE);
if (argtype == STR_TAG)
DrawStr (0, 30, GetStrnArg (argptr), A_REPLACE);
else if (argtype == POSINT_TAG || argtype == NEGINT_TAG)
{
num = GetIntArg (argptr);
if (argtype == NEGINT_TAG)
num = -num;
printf_xy (0, 30, "%ld", num);
}
else
{
DrawStr (0, 30, "Wrong arg type!", A_REPLACE);
ngetchx ();
break;
}
ngetchx ();
}
}
Bonsoir,
Pour ton deuxième warning, c'est sans doute parce que ta fonction GetStrnArg(...) te retourne un const char*, et toi tu le stockes dans un char*.
Essaie de modifier la définition de nom_fichier en const char* nom_fichier = NULL; je pense que ça devrait résoudre ton problème.
Pour le dernier warning, change if (*nom_fichier == NULL) en if (nom_fichier == NULL)
Dis moi si ça résout tes problèmes.
Cordialement
Pour ton deuxième warning, c'est sans doute parce que ta fonction GetStrnArg(...) te retourne un const char*, et toi tu le stockes dans un char*.
Essaie de modifier la définition de nom_fichier en const char* nom_fichier = NULL; je pense que ça devrait résoudre ton problème.
Pour le dernier warning, change if (*nom_fichier == NULL) en if (nom_fichier == NULL)
Dis moi si ça résout tes problèmes.
Cordialement
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
il y a deux autres warning qui surgissent du meme genre dans deux fonction la lecture et sauvegarde:
passing arg 1 of 'lecture' discards qualifiers from pointer target type (l''erreur apparait au niveau du nom-fichier l'argument de lecture et l'argument de sauvegarde"),
dis-moi tu t'y connais en virtuel TI, je travail avec l'éditeur Tigcc V0 95 final et pour passer au résultat dans un calculateur virtuel j'y arrive pas!! j'ai télécharger un VTI "83" et ça ne marche pas!! est ce que c'est la bonne versiion, si c'est la bonne comment charger le fichier test dans l'émulateur!!! je me demande
passing arg 1 of 'lecture' discards qualifiers from pointer target type (l''erreur apparait au niveau du nom-fichier l'argument de lecture et l'argument de sauvegarde"),
dis-moi tu t'y connais en virtuel TI, je travail avec l'éditeur Tigcc V0 95 final et pour passer au résultat dans un calculateur virtuel j'y arrive pas!! j'ai télécharger un VTI "83" et ça ne marche pas!! est ce que c'est la bonne versiion, si c'est la bonne comment charger le fichier test dans l'émulateur!!! je me demande
Bonsoir,
Je t'ai déjà expliqué ce que signifiait cette erreur : tu as un pointeur de type const char *, et ta fonction a pour signature void lecture(char *nom_f) , donc le warning te dit "attention, normalement je n'ai pas le droit de modifier ce pointeur, et toi tu me passes en paramètre dans une fonction qui est autorisée à le faire !".
Donc globalement, comme nom_fichier est de type const char*, tu dois t'arranger pour que toutes les méthodes qui le prennent en paramètre prennent un const char* et non pas un simple char*.
Sinon je n'y connais absolument rien en virtuel TI, donc à ce niveau là, tu vas devoir te débrouiller tout seul...
Cordialement.
Je t'ai déjà expliqué ce que signifiait cette erreur : tu as un pointeur de type const char *, et ta fonction a pour signature void lecture(char *nom_f) , donc le warning te dit "attention, normalement je n'ai pas le droit de modifier ce pointeur, et toi tu me passes en paramètre dans une fonction qui est autorisée à le faire !".
Donc globalement, comme nom_fichier est de type const char*, tu dois t'arranger pour que toutes les méthodes qui le prennent en paramètre prennent un const char* et non pas un simple char*.
Sinon je n'y connais absolument rien en virtuel TI, donc à ce niveau là, tu vas devoir te débrouiller tout seul...
Cordialement.