- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- #include <ctype.h>
- #include<dos.h>
-
-
- struct produits
- { int mois;
- int n_piece;
-
- } tprod[25];
-
- struct pieces
- {
- char libelle[11];
- long n_fourn;
- int prix_htva;
- int code;
-
- } tpieces[300];
-
- struct trime {
- int n_pcs;
- char libelle[11];
- int prix;
- int trim1;
- int trim2;
- int trim3;
- int trim4;
- int quantite;
- } t_res[10];
- int der=0;
-
- int encode_pieces ()
-
- {
-
- clrscr();
-
- printf("********* encodage de pieces ***************** \n");
- getch();
- der++;
-
- { printf(" entrez libelle (10 caract max!!): \n");scanf("%s",tpieces[der].libelle);
- tprod[der].n_piece=der;
- printf(" nøfournisseur : \n");scanf("%d",&tpieces[der].n_fourn);
- printf(" entrez prix : \n");scanf("%d",&tpieces[der].prix_htva);
- printf(" entrez code tva : \n");scanf("%d",&tpieces[der].code);
- clrscr();
- }
-
-
- { t_res[der].n_pcs=tprod[der].n_piece;
- strcpy(t_res[der].libelle,tpieces[der].libelle);
- t_res[der].prix=tpieces[der].prix_htva;
- }
-
-
-
- return 0;
-
- }
-
- int encode_prod ()
-
- {
- int mois=0;
- int quant=0;
- int ind=0;
- clrscr();
-
- printf(" ************* listing des courses *************** \n");
- getch();
-
- fflush(stdin);
-
-
- { printf(" entrez le mois pour livraison svp [de 1 … 12 ]: \n");scanf("%d",&mois);
- printf(" entrez le nøde la piece voulue ");scanf("%d",&ind);printf(" vous avez choisi un(e) %s \n",tpieces[ind].libelle);
- printf(" quantit‚ : \n");scanf("%d",&quant);
- t_res[ind].quantite+=quant;
- clrscr();
-
- if (mois>0 && mois<4) { t_res[ind].trim1+=(quant*tpieces[ind].prix_htva); }
-
- else if (mois>3 && mois <7) { t_res[ind].trim2+=(quant*tpieces[ind].prix_htva);}
-
- else if (mois>6 && mois <10) { t_res[ind].trim3+=(quant*tpieces[ind].prix_htva); }
-
- else if (mois>9 && mois <13) { t_res[ind].trim3+=(quant*tpieces[ind].prix_htva);}
-
- } /* boucle for */
-
-
-
-
- return 0;
-
- }
- /* ************************************************************************ */
-
- int charger ()
-
- { int i=0;
- int max;
- clrscr();
-
-
-
- fflush(stdin);
- printf(" r‚capitulatif des ventes trimestrielles \n");
- printf(" -----------------------------------------------\n");
- printf(" nø du produit libelle quantite prix \n");
- printf(" ------------------------------------------------------\n");
-
- for (i=1;i<der+1;i++)
-
- { printf(" %d %s %d %d \n\n",t_res[i].n_pcs,t_res[i].libelle,t_res[i].quantite,t_res[i].prix);
-
- }
-
- printf("\n");
- printf(" nø produit 1øtrim 2øtrim 3øtrim 4øtrim \n");
-
- for(i=1;i<der+1;i++)
-
- {
- printf(" %d %s %d %d %d %d \n",t_res[i].n_pcs,t_res[i].libelle,t_res[i].trim1,t_res[i].trim2,t_res[i].trim3,t_res[i].trim4);
-
-
- }
-
- getch();
- clrscr();
- return 0;
-
- }
-
- int menu()
-
- { char c=NULL;
-
-
- struct time heure_actuelle;
- gettime(&heure_actuelle);
- clrscr();
-
- textcolor(10);
- puts(" ------------- MENU ENCODAGE ---------------\n\n\n");
-
- printf(" horloge systeme : %d h %d min %d sec\n\n",heure_actuelle.ti_hour,heure_actuelle.ti_min,heure_actuelle.ti_sec);
-
- while (c!='4')
- {
- printf(" encoder tableau des pieces [1] \n");
- printf(" encoder tableau des produits [2] \n");
- printf(" charger les resultats [3] \n");
- printf(" quitter [4] \n");
-
- c=toupper(getch());
- switch (c)
-
- { case '1': encode_pieces();break;
- case '2':encode_prod(); break;
- case '3': charger(); break;
-
- };
-
- }
- clrscr();
-
- return 0;
- }
-
- int main ()
-
- { clrscr();
-
- printf(" avant de commencer … encoder voil… quelques petits conseils :\n\n -encode au moins 3 produits \n -retiens les numeros des 3 produits et … quelles produits ils correspondent\n\n\n Voil… c tout, … toi de tester ...\n");
-
- getch();
-
- fflush(stdin);
- textcolor(10);
- menu();
-
- return 0;
-
- }
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include<dos.h>
struct produits
{ int mois;
int n_piece;
} tprod[25];
struct pieces
{
char libelle[11];
long n_fourn;
int prix_htva;
int code;
} tpieces[300];
struct trime {
int n_pcs;
char libelle[11];
int prix;
int trim1;
int trim2;
int trim3;
int trim4;
int quantite;
} t_res[10];
int der=0;
int encode_pieces ()
{
clrscr();
printf("********* encodage de pieces ***************** \n");
getch();
der++;
{ printf(" entrez libelle (10 caract max!!): \n");scanf("%s",tpieces[der].libelle);
tprod[der].n_piece=der;
printf(" nøfournisseur : \n");scanf("%d",&tpieces[der].n_fourn);
printf(" entrez prix : \n");scanf("%d",&tpieces[der].prix_htva);
printf(" entrez code tva : \n");scanf("%d",&tpieces[der].code);
clrscr();
}
{ t_res[der].n_pcs=tprod[der].n_piece;
strcpy(t_res[der].libelle,tpieces[der].libelle);
t_res[der].prix=tpieces[der].prix_htva;
}
return 0;
}
int encode_prod ()
{
int mois=0;
int quant=0;
int ind=0;
clrscr();
printf(" ************* listing des courses *************** \n");
getch();
fflush(stdin);
{ printf(" entrez le mois pour livraison svp [de 1 … 12 ]: \n");scanf("%d",&mois);
printf(" entrez le nøde la piece voulue ");scanf("%d",&ind);printf(" vous avez choisi un(e) %s \n",tpieces[ind].libelle);
printf(" quantit‚ : \n");scanf("%d",&quant);
t_res[ind].quantite+=quant;
clrscr();
if (mois>0 && mois<4) { t_res[ind].trim1+=(quant*tpieces[ind].prix_htva); }
else if (mois>3 && mois <7) { t_res[ind].trim2+=(quant*tpieces[ind].prix_htva);}
else if (mois>6 && mois <10) { t_res[ind].trim3+=(quant*tpieces[ind].prix_htva); }
else if (mois>9 && mois <13) { t_res[ind].trim3+=(quant*tpieces[ind].prix_htva);}
} /* boucle for */
return 0;
}
/* ************************************************************************ */
int charger ()
{ int i=0;
int max;
clrscr();
fflush(stdin);
printf(" r‚capitulatif des ventes trimestrielles \n");
printf(" -----------------------------------------------\n");
printf(" nø du produit libelle quantite prix \n");
printf(" ------------------------------------------------------\n");
for (i=1;i<der+1;i++)
{ printf(" %d %s %d %d \n\n",t_res[i].n_pcs,t_res[i].libelle,t_res[i].quantite,t_res[i].prix);
}
printf("\n");
printf(" nø produit 1øtrim 2øtrim 3øtrim 4øtrim \n");
for(i=1;i<der+1;i++)
{
printf(" %d %s %d %d %d %d \n",t_res[i].n_pcs,t_res[i].libelle,t_res[i].trim1,t_res[i].trim2,t_res[i].trim3,t_res[i].trim4);
}
getch();
clrscr();
return 0;
}
int menu()
{ char c=NULL;
struct time heure_actuelle;
gettime(&heure_actuelle);
clrscr();
textcolor(10);
puts(" ------------- MENU ENCODAGE ---------------\n\n\n");
printf(" horloge systeme : %d h %d min %d sec\n\n",heure_actuelle.ti_hour,heure_actuelle.ti_min,heure_actuelle.ti_sec);
while (c!='4')
{
printf(" encoder tableau des pieces [1] \n");
printf(" encoder tableau des produits [2] \n");
printf(" charger les resultats [3] \n");
printf(" quitter [4] \n");
c=toupper(getch());
switch (c)
{ case '1': encode_pieces();break;
case '2':encode_prod(); break;
case '3': charger(); break;
};
}
clrscr();
return 0;
}
int main ()
{ clrscr();
printf(" avant de commencer … encoder voil… quelques petits conseils :\n\n -encode au moins 3 produits \n -retiens les numeros des 3 produits et … quelles produits ils correspondent\n\n\n Voil… c tout, … toi de tester ...\n");
getch();
fflush(stdin);
textcolor(10);
menu();
return 0;
}