Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in language C: A travel agency asks you to develop an application that allows you to manage your travelers. A traveler is characterized by: -

in language C: A travel agency asks you to develop an application that allows you to manage your travelers. A traveler is characterized by: - A login - A name - A first name - A number of trips - A set of trips, each trip is characterized by: - a destination - a travel date defined by three integers: day, month and year A) Define the necessary structures. B) Write a program that allows via a menu of: 1. Complete a table of n travelers. 2. Sort travelers' trips in ascending order of date. 3. View the travelers table (All fields).(display)
 *****************************************************

my program does not work

**************************************************************

#include #include #include #include #define TAILLE 50

typedef struct Date { int jour;//day int mois;//month int annee;//year }date;

typedef struct destination { char destination[20]; date datedevoyage;// day of trip }nomdedestination;//name of destination typedef struct Voyageur // traveler { char id[20]; char nom[20];//name char prenom[20];//first name int nbvoyage; // number of trip nomdedestination voyage;//name of destination

}voyageur; // traveler void Remplir(voyageur alpha[], nomdedestination beta[], int taille); //Complete a table of n travelers and taille = size //void Trier(voyageur alpha[], nomdedestination beta[], int taille);//Sort travelers' trips in ascending order of date. void Affichage(voyageur alpha[], nomdedestination beta[], int taille);//View the travelers table (All fields).

int main() { nomdedestination k[20]; voyageur p[20]; date t[20];

Remplir(&p, &k, 1); //Trier(&p, &k, 2); Affichage(&p, &k, 1); _getch(); }

void Remplir(voyageur alpha[], nomdedestination beta[], int taille) { for (int i = 0; i < taille; ++i) { printf("entrer le id de voyageur = "); scanf("%s", alpha[i].id); printf("entrer le nom de voyageur = "); scanf("%s", alpha[i].nom); printf("entrer le prenom de voyageur = "); scanf("%s", alpha[i].prenom); printf("entrer le nombre de voyage = "); scanf("%d", &alpha[i].nbvoyage); if (alpha[i].nbvoyage >= 1) { for (int j = 0; j < alpha[i].nbvoyage; j++) { printf("son nom voyage = "); scanf("%s", alpha[j].voyage.destination); printf("la date jour mois annee = "); scanf("%d", &alpha[j].voyage.datedevoyage.jour); scanf("%d", &alpha[j].voyage.datedevoyage.mois); scanf("%d", &alpha[j].voyage.datedevoyage.annee); } } else printf("il n a pas de voyage recemment"); // no trip

}

} void Trier(voyageur alpha[], nomdedestination beta[], int taille) { int i, j; voyageur gamma; for (i = 0; i < taille; i++) {

for (j = 0; j < taille - 1; j++) { if (beta[j].datedevoyage.annee > beta[j + 1].datedevoyage.annee) { if (beta[j].datedevoyage.mois > beta[j + 1].datedevoyage.mois) gamma = alpha[j]; alpha[j] = alpha[j + 1]; alpha[j + 1] = gamma;

} }

} } void Affichage(voyageur alpha[], nomdedestination beta[], int taille) { for (int i = 0; i < taille; i++) { printf("id = %s , nom = %s , prenom = %s , nbdevoyage = %s ", alpha[i].id, alpha[i].nom, alpha[i].prenom, alpha[i].nbvoyage); for (int j = 0; j < alpha[i].nbvoyage;++j) { printf(", les destinations = %s , date le %d-%d-%d", alpha[j].voyage.destination, alpha[j].voyage.datedevoyage.jour, alpha[j].voyage.datedevoyage.mois, alpha[j].voyage.datedevoyage.annee);

}

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago