ajout de la fonction sauvegarde

master
Antoine PEREDERII 2 years ago
parent c9e68c1bb5
commit 0ccde78f46

@ -1,2 +1,11 @@
Date nbActivitesJour
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);
return i;
}
/*
void pointsBonus()
{
}
void Sauvegarde(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[], int nbelem)
int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
{
int i;
FILE *flot;
flot = fopen("membres.don", "w");
int i, j;
FILE *flot, *jour;
flot = fopen("membres.don", "a");
jour = fopen("ActivitesJour.don", "a");
if(flot == NULL)
{
printf("Pb d'ouverture du fichier membres.don\n");
return -1;
}
if(jour == NULL)
{
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
return -1;
}
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);
}
/*
void pointsBonus()
{
}
int rechercheEtCreation(int tNoCarte[], int nbClients)
{
int NoCarte, i;

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

BIN
exe

Binary file not shown.

@ -1 +1,10 @@
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"
void testOuverture()
void testOuverture(void)
{
int tNoCarte[500], tage[500], tPointsCarte[500], tCarteActive[500];
int tDate[500], tNbActivitesJour[500];
int tNoCarte[500] = {0}, tage[500] = {0}, tPointsCarte[500] = {0}, tCarteActive[500] = {0};
int tDate[500] = {0}, tNbActivitesJour[500] = {0};
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("Ncarte nom prenom age pointsCarte carteActive nbActivitesJour\n");
printf("Ncarte age pointsCarte carteActive nbActivitesJour Date taillemax\n");
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)
{
testOuverture();
//testOuverture();
testSauvegarde();
return 0;
}
Loading…
Cancel
Save