Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iostream>
- #include<vector>
- using namespace std;
- int main()
- {
- bool inversion(false);
- vector<string>tab;
- {
- tab.push_back ("thomas b");
- tab.push_back ("thomas a");
- tab.push_back ("lounis");
- tab.push_back("anton");
- tab.push_back("youva");
- tab.push_back("pierre");
- tab.push_back("sacha");
- tab.push_back("maxime");
- tab.push_back("clement");
- tab.push_back("janelle");
- tab.push_back("sarah");
- }
- for (auto element : tab)
- {
- cout<< element<<endl;
- }
- cout << endl<<endl;
- do
- {
- inversion=false;
- for (size_t i(0); i<tab.size()-1; i++)
- {
- if (tab[i+1]<tab[i])
- {
- string tampon;
- tampon = tab[i];
- tab[i]=tab[i+1];
- tab[i+1]=tampon;
- inversion=true;
- }
- }
- }
- while (inversion==true);
- for (auto element: tab)
- {
- cout << element<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement