#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<char*> coll;
char str[20];
for(int i = 0; i < 3; i++)
{
cin >> str;
coll.push_back(str);
}
for(int i = 0; i < 3; i++)
cout << coll[i]<< endl;
return 0;
}
When I input 3 strings, why does the vector only catch the last one?
For example when the strings are "China","USA","Russia", the vector only get "Russia".