Skip to content

Commit

Permalink
Update ex3_42.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 21, 2015
1 parent 77141a5 commit 54f4c7f
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ch03/ex3_42.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
#include <iostream>
#include <vector>

using std::vector; using std::cout; using std::endl; using std::begin; using std::end;

int main()
{
vector<int> ivec{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int int_arr[10];

for (int* i = begin(int_arr); i != end(int_arr); ++i)
*i = ivec[i-begin(int_arr)];

for (auto i : int_arr) cout << i << " ";
cout << endl;

return 0;
vector<int> v{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int arr[10];
for (int i = 0; i != v.size(); ++i) arr[i] = v[i];

for (auto i : arr) cout << i << " ";
cout << endl;

return 0;
}

0 comments on commit 54f4c7f

Please sign in to comment.