Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string VilleAvecPlusLivres(int R2[NbRepondants], Repondant_s Repondants[NbRepondants])
- {
- int NbrLivres[NbRepondants], TotalVille = 0, Position = 0, PlusGrand;
- string ListeVille[NbRepondants];
- bool Trouver;
- //Trouver le nombre de livre pour chaque ville
- for (int i = 0; i < NbRepondants; i++)
- {
- Trouver = false;
- for (int j = 0; j < TotalVille && !Trouver; j++)
- {
- if (Repondants[i].Ville == ListeVille[j])
- {
- Trouver = true;
- NbrLivres[j] += R2[i];
- }
- }
- if (!Trouver)
- {
- ListeVille[TotalVille] = Repondants[i].Ville;
- NbrLivres[TotalVille] = R2[i];
- TotalVille++;
- }
- }
- //Trouver le plus grand nombre de livres
- PlusGrand = NbrLivres[0];
- for (int i = 1; i < TotalVille; i++)
- {
- if (PlusGrand < NbrLivres[i])
- {
- PlusGrand = NbrLivres[i];
- Position = i;
- }
- }
- return ListeVille[Position];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement