I am having a problem storing strings into a vector
I now how to store int into a vector
vector<int> vecList(10);
for (int i = 0; i < 10; i++)
vecList[i] = i;
If anyone can point me in the right direction that would be great!!!
Thanks!!!
Printable View
I am having a problem storing strings into a vector
I now how to store int into a vector
vector<int> vecList(10);
for (int i = 0; i < 10; i++)
vecList[i] = i;
If anyone can point me in the right direction that would be great!!!
Thanks!!!
so what is the problem?
std::vector<std::string> strings
[ Moved Thread ]
Code:#include <iostream>
#include <string>
#include <vector>
using std::vector;
using std::string;
using std::ostream_iterator;
using std::cout;
using std::endl;
int main()
{
typedef vector< string > TString;
TString tString;
tString.push_back("Hello");
tString.push_back("World");
std::copy( tString.begin(), tString.end(), ostream_iterator<string> (cout, "\n"));
return 0;
}