Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- class Words{
- public:
- void setWord(string w){
- word.push_back(w);
- }
- void printWords(){
- for (auto x : word){
- cout<< x << " ";
- }
- }
- private:
- vector<string> word;
- };
- int main()
- {
- Words city;
- city.setWord("Voronezh");
- city.setWord("Lipetsk");
- city.setWord("Moscow");
- city.printWords();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement