3 pièce(s) jointe(s)
Organisation de donnees avec <map>
je possede un fichier:
Citation:
Larks'_Tongues_In_Aspic,_Part_III 5:56 King_Crimson Three_of_a_Perfect_Pair Rock 9
Between_the_Devil_and_the_Deep_Blue_Sea 2:44 Larkins,_Ellis Jazz_Piano_III_(A_Smithsonian_Collection) Jazz 2
Exiles 5:47 King_Crimson Larks'_Tongues_In_Aspic Rock 3
Larks'_Thrak 2:37 League_of_Crafty_Guitarists Intergalactic_Boogie_Express Rock 3
Schubert-Liszt,_Hark,_Hark,_The_Lark 3:03 Paderewski,_Ignace Josef_Hofmann_&_Ignace_Jan_Paderewski_Play_Liszt Classical 5
Larks'_Tongues_In_Aspic,_Part_2 6:57 King_Crimson Larks'_Tongues_In_Aspic Rock 6
Book_of_Saturday 2:49 King_Crimson Larks'_Tongues_In_Aspic Rock 2
Schubert-Liszt,_Hark,_Hark_the_Lark 2:57 Paderewski,_Ignace Paderewski_Plays_Concert_No._1 Classical 7
Balakirev,_The_Lark 5:25 Lewin,_Michael A_Russian_Piano_Recital Classical 2
que je voudrais organiser en tant que:
Citation:
King Crimson
_____Larks' Tongues In Aspic
_____Three of a Perfect Pair
Larkins, Ellis
_____Jazz Piano III (A Smithsonian Collection)
League of Crafty Guitarists
_____Intergalactic Boogie Express
Lewin, Michael
_____A Russian Piano Recital
Paderewski, Ignace
_____Josef Hofmann & Ignace Jan Paderewski Play Liszt
_____Paderewski Plays Concert No. 1
J'ai ecris du code de facon a avoir une map, des structures pour chaque information.
Mais je ne n'arrive a imprimer la liste que celles des artistes:
Citation:
King Crimson
Larkins, Ellis
League of Crafty Guitarists
Lewin, Michael
Paderewski, Ignace
avec la boucle suivante:
Code:
1 2 3 4 5
|
for (arit = artists.begin(); arit != artists.end(); arit++) {
a = arit->second;
cout << "\n" << a->name << endl;
} |
Mais quand je veux mettre l'album de l'artiste en dessous de son nom, j'ai tout les albums qui s'affichent en meme temps, pour chaque artiste.
Code:
1 2 3 4 5 6 7
| for (arit = artists.begin(); arit != artists.end(); arit++) {
a = arit->second;
cout << "\n" << a->name << endl;
for (ait = albums.begin(); ait != albums.end(); ait++) {
cout << " " << ait->first << "\n";
}
} |
Comme ce n'est pas evident de m'aider avec la page de code que j'ai, j'ai attache le fichier (lib2.cpp), compilable, avec sa librairie (lib2.h), et le fichier "Lark.txt" a specifier en tant que UNIX>./lib2 Lark.txt.
Ca serait genial si quelqu'un s'interesse a mon code et m'aide, j'aimerais bien comprendre sur quoi je plante.
Merci