@ -3,7 +3,7 @@
# include "saeN.h"
# include "saeN.h"
# define TAILLE 50
# define TAILLE 50
int c reeadherent( int * tNC , char * tN , char * tPR , int * tA , int * tCA , int * tPO , int Tmax )
int c ha rg em ent adherent( int * tNC , char * tN , char * tPR , int * tA , int * tCA , int * tPO , int Tmax ) //j'ai renommé la fonction car c'est le plus le chargement que la création
{
{
int NC , N , PR , A , CA , PO , i = 0 ;
int NC , N , PR , A , CA , PO , i = 0 ;
FILE * fe ;
FILE * fe ;
@ -52,7 +52,7 @@ void affichageA(int *tNC,char *tN,char *tPR,int *tA,int *tCA,int *tPO, int n)
printf ( " ---------------------------------------------------------------------------- \n " ) ;
printf ( " ---------------------------------------------------------------------------- \n " ) ;
}
}
int recherche ( int * tNC , int n , int val , int * trouve )
/*int recherche(int*tNC,int n, int val, int* trouve)
{
{
int i ;
int i ;
for ( i = 0 ; i < n ; i + + )
for ( i = 0 ; i < n ; i + + )
@ -86,12 +86,16 @@ void globale()
n = creeadherent ( tNC , tN , tPR , tA , tCA , tPO , 250 ) ;
n = creeadherent ( tNC , tN , tPR , tA , tCA , tPO , 250 ) ;
affichageA ( tNC , tN , tPR , tA , tCA , tPO , n ) ;
affichageA ( tNC , tN , tPR , tA , tCA , tPO , n ) ;
valtrouve = recherche ( tNC , n , 100 , & trouve ) ;
valtrouve = recherche ( tNC , n , 100 , & trouve ) ;
}
} */
void gestionAvecMenu ( void )
void gestionAvecMenu ( void )
{
{
int idSports [ TAILLE ] , nbPtSpo [ TAILLE ] , n , choix ;
int idSports [ TAILLE ] , nbPtSpo [ TAILLE ] , nSports /*nb de sports, choix;
n = chargementSport ( idSports , nbPtSpo , TAILLE ) ;
int tNC [ 50 ] , tA [ 50 ] , tCA [ 50 ] , tPO [ 50 ] ; //pour tes fonctions
int nAdherent /*nb d'adherents*/ , valtrouve , trouve ; //J'ai enlevé Tmax vu que j'avais déjà define TAILLE à 50 , mais faudra probablement y changer vu que ça fait pas bcp 50 adhérents
char tN [ 50 ] , tPR [ 50 ] ;
nSports = chargementSport ( idSports , nbPtSpo , TAILLE ) ;
nAdherent = chargementadherent ( tNC , tN , tPR , tA , tCA , tPO , TAILLE ) ;
printf ( " ------------------------------------------------ \n " ) ; //tableau qui s'affiche en premier pour choisir
printf ( " ------------------------------------------------ \n " ) ; //tableau qui s'affiche en premier pour choisir
printf ( " | Gestion des activités | \n " ) ;
printf ( " | Gestion des activités | \n " ) ;
printf ( " | | \n " ) ;
printf ( " | | \n " ) ;
@ -99,22 +103,30 @@ void gestionAvecMenu (void)
printf ( " | 2. Ajout d'une Activité | \n " ) ;
printf ( " | 2. Ajout d'une Activité | \n " ) ;
printf ( " | 3. Suppression d'une Activité | \n " ) ;
printf ( " | 3. Suppression d'une Activité | \n " ) ;
printf ( " | 4. Changer le prix d'une activité | \n " ) ;
printf ( " | 4. Changer le prix d'une activité | \n " ) ;
printf ( " | 5. Afficher les adhérents | \n " ) ;
printf ( " | 6. Ajouter un adhérent | \n " ) ;
printf ( " | | \n " ) ; //espace libre , vérifie que ça s'affiche bien en testant si tu y change
printf ( " | | \n " ) ; //espace libre , vérifie que ça s'affiche bien en testant si tu y change (tu peux toujours rajouter plus de fonctions stv)
printf ( " | 9. Quitter | \n " ) ;
printf ( " | 9. Quitter | \n " ) ;
printf ( " | | \n " ) ;
printf ( " | | \n " ) ;
printf ( " ------------------------------------------------ \n " ) ; //tableau qui s'affiche en premier pour choisir
printf ( " ------------------------------------------------ \n " ) ; //tableau qui s'affiche en premier pour choisir
printf ( " Rentrez un chiffre : \n " ) ; //choix de l'option
printf ( " Rentrez un chiffre : \n " ) ; //choix de l'option
scanf ( " %d%*c " , & choix ) ;
scanf ( " %d%*c " , & choix ) ;
if ( choix = = 1 )
if ( choix = = 1 )
{ printf ( " \n " ) , affichage ( idSports , nbPtSpo , n ) ; printf ( " \n " ) ; }
{ printf ( " \n " ) ; affichage ( idSports , nbPtSpo , n Sports ) ; printf ( " \n " ) ; }
if ( choix = = 2 )
if ( choix = = 2 )
{ printf ( " \n " ) , ajoutSport ( idSports , nbPtSpo , & n , TAILLE ) ; printf ( " \n " ) ; }
{ printf ( " \n " ) ; ajoutSport ( idSports , nbPtSpo , & n Sports , TAILLE ) ; printf ( " \n " ) ; }
if ( choix = = 3 )
if ( choix = = 3 )
{ printf ( " \n " ) , enl è veSport ( idSports , nbPtSpo , & n ) ; printf ( " \n " ) ; }
{ printf ( " \n " ) ; enl è veSport ( idSports , nbPtSpo , & n Sports ) ; printf ( " \n " ) ; }
if ( choix = = 4 )
if ( choix = = 4 )
{ printf ( " \n " ) , changprix ( idSports , nbPtSpo , n ) ; printf ( " \n " ) ; }
{ printf ( " \n " ) ; changprix ( idSports , nbPtSpo , nSports ) ; printf ( " \n " ) ; }
if ( choix = = 5 )
{ printf ( " \n " ) ; affichageA ( tNC , tN , tPR , tA , tCA , tPO , nAdherent ) ; printf ( " \n " ) ; }
if ( choix = = 6 )
{ printf ( " \n " ) ; /*Quand t'aura fait la fonction*/ ; printf ( " \n " ) ; }
if ( choix = = 9 ) //quitte le logiciel si l'utilisateur a rentré 9
if ( choix = = 9 ) //quitte le logiciel si l'utilisateur a rentré 9
{ printf ( " \n " ) ; printf ( " Arrêt du logiciel " ) ; printf ( " \n " ) ; printf ( " \n " ) ; }
{ printf ( " \n " ) ; printf ( " Arrêt du logiciel " ) ; printf ( " \n " ) ; printf ( " \n " ) ; }
sauvegardeSports ( idSports , nbPtSpo , n ) ;
sauvegardeSports ( idSports , nbPtSpo , n Sports ) ;
return ;
return ;
}
}
@ -166,7 +178,7 @@ void affichage (int *idSports, int *pt, int n)
}
}
}
}
int recherche Sport ( int * tablchoisi , int tailletabl , int valacherch , char * trouvoupas )
int recherche ( int * tablchoisi , int tailletabl , int valacherch , char * trouvoupas )
{
{
int i ;
int i ;
for ( i = 1 ; i < tailletabl ; i + + )
for ( i = 1 ; i < tailletabl ; i + + )
@ -197,7 +209,7 @@ void ajoutSport (int *idSports, int *pt, int *n, int taillePhys)
scanf ( " %d%*c " , & nvSpo ) ;
scanf ( " %d%*c " , & nvSpo ) ;
printf ( " Nombre de points du nouveau sport: \n " ) ;
printf ( " Nombre de points du nouveau sport: \n " ) ;
scanf ( " %d%*c " , & nvNbPt ) ;
scanf ( " %d%*c " , & nvNbPt ) ;
place = recherche Sport ( idSports , * n , nvSpo , & trouvoupas ) ; //donne où il doit ajouter le sport ou si il existe pas déjà
place = recherche ( idSports , * n , nvSpo , & trouvoupas ) ; //donne où il doit ajouter le sport ou si il existe pas déjà
if ( trouvoupas = = ' O ' ) //si le sport existe déjà
if ( trouvoupas = = ' O ' ) //si le sport existe déjà
{
{
printf ( " Erreur, le sport existe déjà \n " ) ;
printf ( " Erreur, le sport existe déjà \n " ) ;
@ -220,7 +232,7 @@ void changprix (int *idSport, int *pt, int n)
char trouve ;
char trouve ;
printf ( " Changer le prix de quel sport ? \n " ) ;
printf ( " Changer le prix de quel sport ? \n " ) ;
scanf ( " %d%*c " , & SpoChoix ) ;
scanf ( " %d%*c " , & SpoChoix ) ;
place = recherche Sport ( idSport , n , SpoChoix , & trouve ) ;
place = recherche ( idSport , n , SpoChoix , & trouve ) ;
if ( trouve = = ' N ' )
if ( trouve = = ' N ' )
{
{
printf ( " Erreur, le sport n'existe pas \n " ) ;
printf ( " Erreur, le sport n'existe pas \n " ) ;
@ -237,7 +249,7 @@ void enlèveSport (int *idSport, int *pt, int *n)
char trouvoupas ;
char trouvoupas ;
printf ( " Numéro du sport à supprimer: \n " ) ;
printf ( " Numéro du sport à supprimer: \n " ) ;
scanf ( " %d%*c " , & supSpo ) ;
scanf ( " %d%*c " , & supSpo ) ;
place = recherche Sport ( idSport , * n , supSpo , & trouvoupas ) ; //donne la place du sport et si il l'a trouvé
place = recherche ( idSport , * n , supSpo , & trouvoupas ) ; //donne la place du sport et si il l'a trouvé
if ( trouvoupas = = ' N ' ) //il ne l'a pas trouvé
if ( trouvoupas = = ' N ' ) //il ne l'a pas trouvé
{
{
printf ( " Erreur, le sport existe pas \n " ) ;
printf ( " Erreur, le sport existe pas \n " ) ;