vector1.C |
#include <iostream.h> #include <vector.h> int main() { int i, n; vector<double> a; cout << "input integer: "; cin >> n; vector<double> b(n); for (i = 0; i < n; i++) b[i] = i; a = b; for (i = 0; i < a.size(); i++) cout << a[i] << ' '; cout << endl; #if 0 n = b.size(); b.resize(n * 2); for (i = n; i < b.size(); i++) b[i] = b[i - n]; for (i = 0; i < b.size(); i++) cout << b[i] << ' '; cout << endl; #endif } |