ajout de la fonction sauvegarde

master
Antoine PEREDERII 2 years ago
parent c9e68c1bb5
commit 0ccde78f46

@ -1,2 +1,11 @@
Date nbActivitesJour Date nbActivitesJour
13052022 120 13052022 120
0 0
5 5
7 7
8 8
8 8
6 6
6 6
2 2
1 1

34
SAE.c

@ -52,29 +52,43 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
fclose(flot); fclose(flot);
return i; return i;
} }
/*
void pointsBonus()
{
} int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
void Sauvegarde(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[], int nbelem)
{ {
int i; int i, j;
FILE *flot; FILE *flot, *jour;
flot = fopen("membres.don", "w"); flot = fopen("membres.don", "a");
jour = fopen("ActivitesJour.don", "a");
if(flot == NULL) if(flot == NULL)
{ {
printf("Pb d'ouverture du fichier membres.don\n"); printf("Pb d'ouverture du fichier membres.don\n");
return -1; return -1;
} }
if(jour == NULL)
{
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
return -1;
}
for(i = 0; i < (nbelem-1); i++) for(i = 0; i < (nbelem-1); i++)
{ {
fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tnom[i], tprenom[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitéesJour[i]); fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i]);
} }
for(j = 0; j < (nbelem-1); j++)
{
fprintf(jour, "%d\t%d\n", tDate[j], tNbActivitesJour[j]);
}
fclose(jour);
fclose(flot); fclose(flot);
} }
/*
void pointsBonus()
{
}
int rechercheEtCreation(int tNoCarte[], int nbClients) int rechercheEtCreation(int tNoCarte[], int nbClients)
{ {
int NoCarte, i; int NoCarte, i;

@ -1,10 +1,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int Ouverture(); int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax);
void testOuverture(); void testOuverture(void);
int Sauvegarde();
void testSauvegarde(void);
/* /*
int pointsBonus(); int pointsBonus();
void sauvegarde();
int CreationAdherent(); int CreationAdherent();
int FrequenceCentre();*/ int FrequenceCentre();*/

BIN
exe

Binary file not shown.

@ -1 +1,10 @@
Ncarte age pointsCarte carteActive Ncarte age pointsCarte carteActive
0 0 0 0 1691030928 1691028928 1691032928
5 5 5 5 1691030928 1691028928 1691032928
7 7 7 7 1691030928 1691028928 1691032928
8 8 8 8 1691030928 1691028928 1691032928
8 8 8 8 1691030928 1691028928 1691032928
6 6 6 6 1691030928 1691028928 1691032928
6 6 6 6 1691030928 1691028928 1691032928
2 2 2 2 1691030928 1691028928 1691032928
1 1 1 1 1691030928 1691028928 1691032928

@ -1,19 +1,27 @@
#include "SAE.h" #include "SAE.h"
void testOuverture() void testOuverture(void)
{ {
int tNoCarte[500], tage[500], tPointsCarte[500], tCarteActive[500]; int tNoCarte[500] = {0}, tage[500] = {0}, tPointsCarte[500] = {0}, tCarteActive[500] = {0};
int tDate[500], tNbActivitesJour[500]; int tDate[500] = {0}, tNbActivitesJour[500] = {0};
int tmax = 500, pas, i; int tmax = 500, pas, i;
pas = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, &tmax); pas = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, tmax);
printf("Pas: %d", &pas); printf("Pas: %d", &pas);
printf("Ncarte nom prenom age pointsCarte carteActive nbActivitesJour\n"); printf("Ncarte age pointsCarte carteActive nbActivitesJour Date taillemax\n");
for(i=0; i < pas; i++) for(i=0; i < pas; i++)
printf("\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitesJour[i], tDate[i], &tmax); printf("\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitesJour[i], tDate[i], &tmax);
}
void testSauvegarde(void)
{
int tNoCarte[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tage[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tPointsCarte[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tCarteActive[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0};
int tDate[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tNbActivitesJour[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0};
Sauvegarde(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, 10);
} }
int main(void) int main(void)
{ {
testOuverture(); //testOuverture();
testSauvegarde();
return 0; return 0;
} }
Loading…
Cancel
Save