C++ STL - Vector in place of arrays
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{ vector < string > sentence(5);
sentence[0] = "one";
sentence[1] = "if";
sentence[2] = "by";
sentence[3] = "sea";
for (int i = 0; i < sentence.size(); ++i)
cout << sentence[i] << '\t';
}
Previous slide
Next slide
Back to first slide
View graphic version