Problème de code

Résolu
Stéphanie -  
 nwiwla.cbn -
Bonjour,

je voudrais faire un boutton qui me permettrai d'imprimer uniquement les cellules sélectionnées.
Mon code ne marche pas.

Est-ce que je suis loin du compte ?

For Each cellules In Selection
ActiveSheet.PageSetup.PrintArea = ActiveCell
ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Exit For

End sub

Merci pour votre attention.
Configuration: Windows 2000
Internet Explorer 6.0

4 réponses

  1. yg_be Messages postés 23437 Date d'inscription   Statut Contributeur Dernière intervention   Ambassadeur 1 588
     
    Et ceci, cela donne quoi ?

    Selection.PrintOut
    0
    1. Jo
       
      Super !

      Problème résolu !

      Pourquoi faire complexe quand on peut faire simple ?

      Merci.
      0
  2. tongo11
     
    bon jour je cherche le code ou la clee nagravision satillite thor merci
    0
  3. nwiwla.cbn
     
    salut les amis s'il vous plait j'ai besoin de l'aide au sujet d'un code en c j'ai des messages d'erreurs=
    warning; Multi-character constant
    deux fois,
    assignment discards qualifiers from pointer target type
    et comparaison between pointer and integer:

    je vous envoie le code :
    /*******************************************

    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) ;
    }
    }
    0
  4. nwiwla.cbn
     
    salut les amis s'il vous plait j'ai besoin de l'aide au sujet d'un code en c j'ai des messages d'erreurs=
    warning; Multi-character constant
    deux fois,
    assignment discards qualifiers from pointer target type
    et comparaison between pointer and integer:

    je vous envoie le code :
    /*******************************************

    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) ;
    }
    }
    0