Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- void PrintVector(const vector<string>& v)
- {
- for (string s : v)
- {
- cout << s << endl;
- }
- }
- int main()
- {
- int n;
- cin >> n;
- vector<string> v(n); //конструктор вектора
- for (string& s : v)
- {
- cin >> s;
- cout << "Current size = " << v.size() << endl;
- }
- ****************************************************************
- vector <string> v;
- int i = 0;
- while (i < n)
- {
- string s;
- cin >> s;
- v.push_back(s);
- cout << "Current size = " << v.size() << endl;
- ++i;
- }
- ****************************************************************
- PrintVector(v);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement