Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void trouver(gateau tabG[],int tg,int type,int *pos)
- {
- int i,v=0;
- for(i=0;i<tg;i++)
- {
- if((v==0)&&(tabG[i].type==type))
- {
- *pos=i;
- v=1;
- }
- }
- }
- float calculerPrix(gateau g)
- {
- int i=0,p;
- float prix;
- for(i=0;i<g.nbIngredients;i++)
- {
- prix=prix+(g.tabI[i].quantity*g.tabI[i].price);
- }
- switch(g.type)
- {
- case 0:
- p=20;
- break;
- case 1:
- p=10;
- break;
- case 2:
- p=15;
- break;
- }
- prix=(prix*100)/p;
- return prix;
- }
- void vendre(int matV[][7],gateau tabG[],int type,int jour,int *tg,float tabP[])
- {
- int i,pos;
- gateau g;
- trouver(tabG,*tg,type,&pos);
- g=tabG[pos];
- tabP[jour]=tabP[jour]+calculerPrix(g);
- matV[jour][g.type]=matV[jour][g.type]+1;
- for (i=pos;i<(*tg);i++)
- {
- tabG[i]=tabG[i+1];
- }
- (*tg)=(*tg)-1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement