Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- ///Idee du programme : aller jusqu'à un espace, prendre ce qu'il y a dans l'int où ça recommence et où on arrive à l'espace, si c'est une fois immpaire qu'on s'arrête, alors c'est un nom
- ///si c'est une fois paire, alors c'est un prenom. Traiter chaque couple nom-prenom à la fois
- using namespace std;
- ///Fonction (P. Nom)///
- string formattage(string nom, string prenom)
- {
- nom=nom[0]+".";
- nom+=prenom;
- return nom;
- }
- int main()
- {
- ifstream fichier("users.txt");
- if(fichier.is_open())
- {
- string nom,prenom;
- while(fichier >> nom && fichier >> prenom)
- {
- cout << formattage(nom, prenom) << endl;
- }
- }
- else
- cout << "ERREUR Le fichier ne s'est pas ouvert" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement