iter1.cpp

We use cookies. Read the Privacy and Cookie Policy

iter1.cpp

#include ‹iostream.h›

#include ‹stl.h›

int main() {

 vector‹const char*› v; // Vector of character strings.

 v.push_back((char*) "zippy"); // First element.

 v.push_back((char*) "motorboy"); // Second element.

 vector‹const char*›::iterator i = v.begin(); // Position at end.

 for (i = v.begin(); i != v.end(); i++) cout ‹‹ *i ‹‹ endl; // Display item.

 return 0;

}