1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Client
struct Client
{
int IDClient;
char NomC[50];
char Adresse[5];
char Ville[20];
char Tel[13];
char TypeC[20];
}Client;
typedef struct produit
struct produit
{
char typeProduit;
int IDProd;
struct produit *Psuit;
}*produit;
typedef struct ListeProduct
struct ListeProduct
{
char typeProd[20];
int PrixPS;
struct ListeProduct *listePsuit;
}
typedef struct Magasin
struct Magasin
{
int NumMg;
char NomMg[20];
char RefPro[4];
char AdresseMg[20];
produit PMg;
struct Magasin *MagasinSuit;
}*Magasin;
typedef struct contract
struct contract
{
int NumCtr;
char DateCtr[11];
int Duree;
Magasin MnCtr;
int montant;
Client ClientCtr;
produit prodCtr;
int QantiteCtr;
}
int VerfyQuantity(Magasin MgV)
{
char NomProd[20];
unsigned int Q;
unsigned int Qp = 0;
printf("\nBienvenu dans notre magasin de location.\nFaites comme chez vous.\nQuel est le matériel que vous voulez louer");
scanf("%s",NomProd);
printf("Quelle quantite de materiel voulez-vous louer?");
scanf("%d",&Q);
while(MgV->Mg!=NULL)
{
if(MgV->Mg->typeProduit == NomProd)
{
Qp++;
}
MgV->Mg=MgV->PMg->Psuit;
}
return Qp;
}
void RemettrePro(char nom,int Q,Magasin Mgf)
{
for(i=1;i<=Q;i++)
{
SupprimeProd(nom);
}
}
Client *EnregisClient(Client Client1)
{
printf("Donner votre nom:\n");
scanf("%s",Client1.NomC);
printf("Aresse:")
scanf("%s",Client1.Adresse);
printf("Ville:");
scanf("%s",Client1.Ville);
printf("Teléphone:");
scanf("%s",Client1.Tel);
printf("Type:");
scanf("%s",Client1.TypeC);
return Client1;
}
Magasin *SupprimeProd(Magasin Mg,char nom)
{
produit P=Mg.PMg;
produit Pp;
Pp=p->Psuit;
if(p->typeProduit=nom)
{
free(p);
return Pp;
}
while(Pp->typeProduit!=nom && Pp!=NULL)
{
Pp=Pp->Psuit;
p=p->Psuit;
}
if(Pp->typeProduit==nom)
{
p->Psuit=Pp->Psuit;
free(Pp);
return p;
}
}
void RemettrePro(char nom,int Q,Magasin Mgf)
{
for(i=1;i<=Q;i++)
{
Mgf=SupprimeProd(Magasin Mg,char nom);
}
}
void gestionLocation(Client clint,Magasin Mg)
{
unsigned int Ql;
printf("Donner la quantité:");
scanf("%d",Ql);
if (Ql>=VerfyQuantity(Mg,int Q,char TypeP))
{
writeFacture(Client client);
CompleteLocaArchive(Client client);
SupprimeProd(nom,Q,Mg);
}
}
void Gestion(Magasin Mg)
{
Client Client1;
Client1=EnregisClient(Client1);
} |
Partager