Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<iostream>
- #include<cstdlib>
- #include<string>
- #include<vector>
- #include<algorithm>
- using namespace std;
- string format(string ime) {
- int z1, z2, i;
- string imeF, s;
- z1 = ime.find_first_of('(', 0);
- z2 = ime.find_first_of(')', 0);
- s = " ";
- s.push_back(ime[z1 + 1]);
- s.push_back('.');
- s.push_back(' ');
- imeF = ime.replace(z1, z2 - z1 + 1, s);
- return imeF;
- }
- void main() {
- vector<string> ime, imeF;
- string s, temp;
- int i = 0;
- cout << "Unosi stringove, kada si gotov unesi 0\n";
- while (getline(cin, temp))
- {
- //if (temp.compare("0") == 0) { break; }
- ime.push_back(temp);
- }
- for (i = 0; i < ime.size(); i++) {
- imeF.push_back(format(ime[i]));
- }
- sort(imeF.begin(), imeF.end());
- for (i = 0; i < ime.size(); i++) {
- cout << imeF[i] << endl;
- }
- getchar();
- }
Add Comment
Please, Sign In to add comment