new version

master
Lola CHALMIN 2 years ago
parent 35473f298d
commit 1e52748f79

17
sae.c

@ -234,7 +234,8 @@ int ChoiceActi(int nbacti, int *tacti)
chxacti = chx1 + chx2*10 ; chxacti = chx1 + chx2*10 ;
} }
else
if (nbacti == 3)
{ {
chx1 = Acti(nbacti-2); chx1 = Acti(nbacti-2);
chx2 = Acti(nbacti-1); chx2 = Acti(nbacti-1);
@ -258,19 +259,18 @@ void ChoiceMenu(char *choix)
} }
void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti) void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf)
{ {
int u , d, c, actu, actd, actc, ptsneeded; printf("%d\n", acti);
int u , d, c, actu = 0, actd = 0, actc = 0, ptsneeded;
char confirm; char confirm;
u = acti % 10;//acti1 u = acti % 10;//acti1
d = (acti-u) / 10 ;//acti2 d = (acti % 100 )/10 ;//acti2
c = acti / 100;//acti3 c = acti / 100;//acti3
actu = CheckActi(u); actu = CheckActi(u);
printf
actd = CheckActi(d); actd = CheckActi(d);
actc = CheckActi(c); actc = CheckActi(c);
ptsneeded = actu + actd + actc; ptsneeded = actu + actd + actc;
printf("%d", ptsneeded);
if (ptsneeded <= tptsbought[place]) if (ptsneeded <= tptsbought[place])
{ {
@ -285,14 +285,17 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int
tptsbought[place] += 15; tptsbought[place] += 15;
tptsbonus[place] -= 100; tptsbonus[place] -= 100;
} }
tacti[place] = acti;
} }
} }
else else
{ {
printf("J'y vais pas"); *insuf = 1;
} }
} }
int CheckActi(int nb) int CheckActi(int nb)
{ {
if (nb == 1)//badminton if (nb == 1)//badminton

@ -10,4 +10,4 @@ int Acti(int i);
void ChoiceMenu(char *choix); void ChoiceMenu(char *choix);
int CheckActi(int nb); int CheckActi(int nb);
int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax);
void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti); void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf);

@ -4,8 +4,8 @@
void main(void) void main(void)
{ {
int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret; int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf;
char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix; char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge;
Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
printf("Bienvenue ! \nMembre (M) | Création compte (C)\n"); printf("Bienvenue ! \nMembre (M) | Création compte (C)\n");
@ -76,10 +76,21 @@ void main(void)
} }
chxacti = ChoiceActi(nbacti, tacti); chxacti = ChoiceActi(nbacti, tacti);
CheckPts(tptsbonus, tptsbought, tpasseoupas, place, chxacti); CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, &insuf);
if (insuf == 1)
{
printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)");
scanf("%*c%c%*c", &recharge);
if (recharge == 'R')
{
Recharge(tptsbought, place, tcateg);
}
else
{
ChoiceMenu(&choix);
}
}
tacti[place] = chxacti;
ChoiceMenu(&choix); ChoiceMenu(&choix);
@ -90,7 +101,5 @@ void main(void)
//menuglobal() //menuglobal()
return; return;
} }
} }
} }

Loading…
Cancel
Save