#include
Char * szhw = "Hello World"; / / It is well known that this is an array of characters ending with NULL
INT Main (int Argc, char * argv []) {Vector
/ / Define iterator Vector
// Initialize character vector, loop the entire string, put each character into the vector until the NULL character char * cptr = szhw; // Hello World string of the character string While (* CPTR! = ') 0 ') {vec.push_back (* cptr); CPTR ;} // push_back function Plug the data into the vectors of the VECTOR
/ / Print each character in the STL array to the screen for (vi = vec.begin (); vi! = Vec.eGin (); vi ) // This is the standard judgment method in the STL cycle - often Use "! =" Rather than "<" // may not have a heavy load operator "<". // begin () and end () get an iterator (pointer) {cout << * vi;} // using indirect operator (*) from the iterator (*) from the iterator (*) Return 0;}