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 ;
}
else
if (nbacti == 3)
{
chx1 = Acti(nbacti-2);
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;
u = acti % 10;//acti1
d = (acti-u) / 10 ;//acti2
d = (acti % 100 )/10 ;//acti2
c = acti / 100;//acti3
actu = CheckActi(u);
printf
actd = CheckActi(d);
actc = CheckActi(c);
ptsneeded = actu + actd + actc;
printf("%d", ptsneeded);
if (ptsneeded <= tptsbought[place])
{
@ -285,14 +285,17 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int
tptsbought[place] += 15;
tptsbonus[place] -= 100;
}
tacti[place] = acti;
}
}
else
{
printf("J'y vais pas");
*insuf = 1;
}
}
int CheckActi(int nb)
{
if (nb == 1)//badminton

@ -10,4 +10,4 @@ int Acti(int i);
void ChoiceMenu(char *choix);
int CheckActi(int nb);
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)
{
int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret;
char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix;
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, recharge;
Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
printf("Bienvenue ! \nMembre (M) | Création compte (C)\n");
@ -76,21 +76,30 @@ void main(void)
}
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);
}
}
if (choix == 'Q')
{
//menuglobal()
return;
}
}
}
}

Loading…
Cancel
Save