|
-
June 9th, 2008, 12:00 AM
#1
Vector containers
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!!!
-
June 9th, 2008, 01:04 AM
#2
Re: Vector containers
so what is the problem?
std::vector<std::string> strings
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
June 9th, 2008, 01:12 AM
#3
Re: Vector containers
[ 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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|