Advertisement
Guest User

article.c

a guest
Apr 9th, 2020
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<stdlib.h>
  4.  
  5.  
  6.  
  7.  
  8. struct Produit{
  9. int code;
  10. char libelle[30];
  11. float prix;
  12. };
  13. typedef struct Produit Produit;
  14.  
  15. struct Pr_en_stocke{
  16. Produit P;
  17. int Qte;
  18. struct Pr_en_stocke* suivant;
  19. };
  20. typedef struct Pr_en_stocke Pr_en_stocke;
  21. typedef Pr_en_stocke* stocke;
  22.  
  23. /*******************Ajoute****************/
  24. stocke ajoute_en_tete(stocke L ,Produit a,int q){
  25. stocke temp;
  26. temp=(stocke)malloc(sizeof(Pr_en_stocke));
  27. temp->P=a;
  28. temp->Qte=q;
  29. temp->suivant=L;
  30. return temp;
  31. }
  32.  
  33. /*******************Affichage****************/
  34. void Afficher_Produit(Produit P)
  35. {
  36. printf("%d %s %.2f",P.code,P.libelle,P.prix);
  37. }
  38.  
  39. void afficher_list(stocke L){
  40. stocke temp;
  41. if(temp=NULL)
  42. {
  43. printf("\n*******la liste*******");
  44. while(temp!=NULL)
  45. {
  46. Afficher_Produit(temp->P);
  47. printf("%d",temp->Qte);
  48. temp=temp->suivant;
  49. }
  50. }
  51. else
  52. printf("\n la liste est vide ");
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement