Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. class Words{
  8. public:
  9. void setWord(string w){
  10. word.push_back(w);
  11. }
  12.  
  13. void printWords(){
  14. for (auto x : word){
  15. cout<< x << " ";
  16. }
  17. }
  18.  
  19. private:
  20. vector<string> word;
  21. };
  22.  
  23.  
  24. int main()
  25. {
  26. Words city;
  27. city.setWord("Voronezh");
  28. city.setWord("Lipetsk");
  29. city.setWord("Moscow");
  30.  
  31. city.printWords();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement