// sample program for std::vector, 2008.5.24 T. Kondo #include #include int main() { using namespace std; vector array; // dynamic array of integer type vector array1; // dynamic array of double type variables double x; for(int i = 0; i < 10; ++i ) { x=i*0.5; array.push_back( i ); array1.push_back( x ); } for(int i = 0; i < 10; ++i ) { cout << array[i] << ", " << array1[i] << endl; } return 0; } $ ./a.exe 0, 0 1, 0.5 2, 1 3, 1.5 4, 2 5, 2.5 6, 3 7, 3.5 8, 4 9, 4.5