You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.4 KiB
88 lines
2.4 KiB
|
|
|
|
float coutLogement (char type, int nbPers, char pension)
|
|
{
|
|
float prix;
|
|
int nbChambres;
|
|
if(type == 'A' || type == 'a')
|
|
if(nbPers <= 4)
|
|
prix = 800;
|
|
else prix = 800 + (nbPers-4)*((800*10.0)/100);
|
|
else
|
|
{
|
|
nbChambres = nbPers/3;
|
|
if(nbPers % 3 != 0)
|
|
nbChambres = nbChambres + 1;
|
|
prix = nbChambres * 230;
|
|
if(pension == 'd' || pension == 'D')
|
|
prix = prix + 120 * nbPers;
|
|
else prix = prix + 210 * nbPers;
|
|
|
|
return prix;
|
|
}
|
|
|
|
// Activité ski //
|
|
|
|
int saisirActiviteSki(int *nbPers, int *nbPack, int *nbSki)
|
|
{
|
|
int *nbPers, *nbPack, *nbSki;
|
|
printf("Nombre de personnes ayant choisie l'activité ski :");
|
|
scanf("%d", *nbPers);
|
|
printf("Nombre de packs de ski :");
|
|
scanf("%d", *nbPack);
|
|
printf("Nombre de ski seuls :");
|
|
scanf("%d", *nbSki);
|
|
if(nbPers < (nbPack + nbSki))
|
|
printf(pb : nombre de personnes et de matériels non cohérents, activité non validée)
|
|
}
|
|
float coutActiviteSki(in nbPers, int nbPack, int nbSki, float *reduc)
|
|
{
|
|
float prixS;
|
|
prixS = nbPers*150 + nbPack*120 + nbSki*80
|
|
reduc =
|
|
|
|
return prixS;
|
|
}
|
|
|
|
// fonction totale //
|
|
|
|
void globale (int nbPers, int nbPack, int nbSki, float reduc)
|
|
{
|
|
float prixS, prix, prixTot;
|
|
char Ski;
|
|
printf("Voulez vous faire du ski (O, N) :")
|
|
scanf("%c%*c", &Ski);
|
|
saisirLogement();
|
|
if()
|
|
prix = coutLogement(type, nbPers, pension);
|
|
if(Ski == 'O' || Ski == 'o');
|
|
{
|
|
saisirActiviteSki();
|
|
prixS = coutActiviteSki(in nbPers, int nbPack, int nbSki);
|
|
prixSR = prixS - reduc;
|
|
prixTot = prix + (prixS - reduc);
|
|
printf("Coût logement : %.2f\n Côut activité ski : %.2f\n Montant reduction ski : %.2f\n Total : %.2f\n", prix, prixS, reduc, prixTot);
|
|
}
|
|
else
|
|
printf("Total : %.2f\n", prixTot);
|
|
}
|
|
|
|
|
|
|
|
void testCoutLogement (char type, int nbPers, char pension, float prix)
|
|
{
|
|
float prix;
|
|
saisirLogement();
|
|
if()
|
|
prix = coutLogement(type, nbPers, pension);
|
|
printf("type de logement : %c nb de personnes : %c pension : %c coût : %.2f\n", type, nbPers, pension, prix);
|
|
}
|
|
|
|
void testCoutActiviteSki (int nbPers, int nbPack, int nbSki, float reduc)
|
|
{
|
|
float prixS;
|
|
saisirActiviteSki();
|
|
prixS = coutActiviteSki(in nbPers, int nbPack, int nbSki);
|
|
prixSR = prixS - reduc;
|
|
printf("cout ss reduc : %.2f Reduc : %.2f cout reduc comprise : %.2f\n", prixS, reduc, prixSR);
|
|
} |