Advertisement
szymcio93

Untitled

Mar 19th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <vector>
  4. #include <string>
  5. using namespace std;
  6.  
  7. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  8.  
  9. int main(int argc, char** argv)
  10. {
  11. vector<string> v;
  12. int i = 0;
  13.  
  14. /*v.push_back('a');
  15. v.push_back('b');
  16. v.push_back('c');
  17.  
  18. v.insert(v.begin(), 'd', 'e');
  19. v.erase(v.begin());
  20. v.insert(v.begin(), 'f');
  21.  
  22. v.pop_back();
  23.  
  24. for(i = 0; i < v.size(); i++)
  25. cout << v[i] << "";
  26. cout << endl;
  27.  
  28. cout << "front = " << v.front() << endl;
  29. cout << "back = " << v.back() << endl;
  30. cout << "size = " << v.size() << endl;
  31. */
  32.  
  33. while (1)
  34. {
  35. string a;
  36. cout << "Podaj slowo numer " << i+1 << endl;
  37. cin >> a;
  38. v.push_back(a);
  39. i=i+1;
  40.  
  41. if(a == ".")
  42. {
  43.  
  44. break;
  45. }
  46.  
  47. if (v.end() == v.end()-1){
  48. v.erase(v.end());
  49. }
  50. }
  51.  
  52. for(i = 0; i < v.size(); i++)
  53. cout << v[i] << " ";
  54. cout << endl;
  55. system("PAUSE");
  56. return EXIT_SUCCESS;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement