Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <string>
- using namespace std;
- void fill(vector<string>& vec)
- {
- string buffer;
- cout << "Baga cuvinte neamule (nimic si enter daca vrei sa iesi din tiganie).\n";
- do {
- getline(cin, buffer);
- vec.push_back(buffer);
- } while (buffer.length());
- vec.pop_back();
- }
- void process(vector<string>& vec)
- {
- sort(vec.begin(), vec.end());
- }
- void show(vector<string>& vec)
- {
- cout << "Cuvintele in ordine lexicografica.\n";
- for (vector<string>::iterator it = vec.begin(); it != vec.end(); it++) {
- cout << *it << " ";
- }
- cout << "\n";
- }
- int main()
- {
- vector<string> vec;
- fill(vec);
- process(vec);
- show(vec);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement