Lola CHALMIN 3 years ago
parent ad40b54835
commit 2924fbae0f

47
sae.c

@ -62,7 +62,7 @@ int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate,
}
fclose(f);
return 0;
return i;
}
@ -254,14 +254,13 @@ void ChoiceMenu(char *choix)
while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q')
{
printf("Entrer un caractère correct R | A | C | Q \n");
scanf("%c%*c", choix);
scanf("%c%*c%*c", choix);
}
}
void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf)
{
printf("%d\n", acti);
int u , d, c, actu = 0, actd = 0, actc = 0, ptsneeded;
char confirm;
u = acti % 10;//acti1
@ -284,6 +283,7 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, cha
{
tptsbought[place] += 15;
tptsbonus[place] -= 100;
tpasseoupas[place] = 1;
}
tacti[place] = acti;
@ -324,3 +324,44 @@ int CheckActi(int nb)
}
}
void Save(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax, int place)
{
int i = 0;
FILE *fs;
fs = fopen("data.don", "a");
if (fs == NULL)
{
printf("Erreur fichier data.don\n");
}
fprintf(fs, "%d ", tAd[i]);
fprintf(fs, "%s ", tnom[i]);
fprintf(fs, "%s\t", tpnom[i]);
fprintf(fs, "%d\t", tage[i]);
fprintf(fs, "%d\t", tstate[i]);
fprintf(fs, "%d\t", tacti[i]);
fprintf(fs, "%d\t", tpasseoupas[i]);
fprintf(fs, "%d\t", tptsbought[i]);
fprintf(fs, "%d\t", tptsbonus[i]);
fprintf(fs, "%c", tcateg[i]);
i++;
for (i; i < place; i++)
{
fprintf(fs, "%d ", tAd[i]);
fprintf(fs, "%s ", tnom[i]);
fprintf(fs, "%s\t", tpnom[i]);
fprintf(fs, "%d\t", tage[i]);
fprintf(fs, "%d\t", tstate[i]);
fprintf(fs, "%d\t", tacti[i]);
fprintf(fs, "%d\t", tpasseoupas[i]);
fprintf(fs, "%d\t", tptsbought[i]);
fprintf(fs, "%d\t", tptsbonus[i]);
fprintf(fs, "%c", tcateg[i]);
}
}

@ -11,3 +11,4 @@ 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 *tacti, char *tcateg, int place, int acti, int *insuf);
void Save(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax, int place);

@ -4,9 +4,9 @@
void main(void)
{
int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf;
int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf, day = 0;
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);
place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
printf("Bienvenue ! \nMembre (M) | Création compte (C)\n");
scanf("%c%*c", &member);
@ -51,6 +51,7 @@ void main(void)
}
}
ChoiceMenu(&choix);
if (choix == 'A')

Loading…
Cancel
Save