Guest User

Untitled

a guest
Jan 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include<cstdio>
  2. #include<iostream>
  3. #include<cstdlib>
  4. #include<string>
  5. #include<vector>
  6. #include<algorithm>
  7. using namespace std;
  8. string format(string ime) {
  9. int z1, z2, i;
  10. string imeF, s;
  11. z1 = ime.find_first_of('(', 0);
  12. z2 = ime.find_first_of(')', 0);
  13. s = " ";
  14. s.push_back(ime[z1 + 1]);
  15. s.push_back('.');
  16. s.push_back(' ');
  17. imeF = ime.replace(z1, z2 - z1 + 1, s);
  18. return imeF;
  19. }
  20.  
  21. void main() {
  22. vector<string> ime, imeF;
  23. string s, temp;
  24. int i = 0;
  25. cout << "Unosi stringove, kada si gotov unesi 0\n";
  26. while (getline(cin, temp))
  27. {
  28. //if (temp.compare("0") == 0) { break; }
  29. ime.push_back(temp);
  30. }
  31. for (i = 0; i < ime.size(); i++) {
  32. imeF.push_back(format(ime[i]));
  33. }
  34. sort(imeF.begin(), imeF.end());
  35. for (i = 0; i < ime.size(); i++) {
  36. cout << imeF[i] << endl;
  37. }
  38. getchar();
  39. }
Add Comment
Please, Sign In to add comment