TP de C++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exercice5.cpp 639B

1234567891011121314151617181920212223242526272829303132
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. using namespace std;
  6. int main(/*int argc, char const *argv[]*/)
  7. {
  8. vector<string> vecteur;
  9. vecteur.push_back("ballon");
  10. vecteur.push_back("ballon de baudruche");
  11. vecteur.push_back("ballon de football");
  12. vecteur.push_back("balai à toilettes");
  13. vecteur.push_back("balene bleue turquoise");
  14. for(vector<string>::iterator it=vecteur.begin(); it!=vecteur.end();it++){
  15. cout << *it << endl;
  16. }
  17. sort(vecteur.begin(),vecteur.end());
  18. for(vector<string>::iterator it2=vecteur.begin(); it2!=vecteur.end();it2++){
  19. cout << *it2 << endl;
  20. }
  21. return 0;
  22. }