vec5.cpp
vec5.cpp
#include ‹iostream.h›
#include ‹stl.h›
int array[] = {1, 4, 9, 16};
int main() {
vector‹int› v(array, array + 4);
for (int i = 0; i ‹ v.size(); i++) cout ‹‹ "v[" ‹‹ i ‹‹ "] = " ‹‹ v[i] ‹‹ endl;
return 0;
}
vec5.cpp
#include ‹iostream.h›
#include ‹stl.h›
int array[] = {1, 4, 9, 16};
int main() {
vector‹int› v(array, array + 4);
for (int i = 0; i ‹ v.size(); i++) cout ‹‹ "v[" ‹‹ i ‹‹ "] = " ‹‹ v[i] ‹‹ endl;
return 0;
}