Bonsoir,
J'effectue ceci :
Avec nom, prenom des string.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 cout << "Nom : " << nom << endl; cout << "Prenom : " << prenom << endl; cout << "Autres : " << personne.getOtherInfos() << endl;
La méthode getOtherInfos renvoi un string dont la représentation est :
"Information 1 : aaa" << endl
"Information 2 : bbbbbb" << endl
"Information 3 : cccc" << endl
L'idée serait d'avoir :
Mais moi j'ai ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Nom : Albert Prenom : Claude Autres : Information 1 : aaa Information 2 : bbbbbb Information 3 : cccc
La méthode getOtherInfos() peut être appelée sans être précédée de l'affichage du Nom et Prenom. Donc, je ne peux pas rajouter des tabulations dans getOtherInfos().
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Nom : Albert Prenom : Claude Autres : Information 1 : aaa Information 2 : bbbbbb Information 3 : cccc
Auriez-vous une idée ? Est-ce possible de faire une tabulation sur un bloc entier de lignes dans cout ?
J'ai déjà regardé du côté de setw et setfill mais ça n'arrange pas mon problème vu que je ne peux pas modifier getOtherInfos() dynamiquement..
Merci
Partager