/ Published in: C++
for example
Expand |
Embed | Plain Text
#include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { int a = 1; vector<int> vec(50,0); for(vector<int>::iterator it = vec.begin(); it != vec.end(); ++it) { *it = a++; } int arr[5][10]; vector<int>::iterator it = vec.begin(); for(int i = 0; i < 5; ++i) { for(int j = 0; j < 10; ++j) { arr[i][j] = *it; ++it; cout << setw(4) << arr[i][j]; } cout << '\n'; } cout << endl; }
You need to login to post a comment.
