Created
April 21, 2018 04:55
-
-
Save penut85420/352a8042a1efeaf116c111d814577fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
void print_vector(vector<int>& v) { | |
for(int i = 0; i < v.size(); i++) { | |
cout << v[i] << " "; | |
} | |
} | |
int main() { | |
int a[5] = {1, 2, 3, 4, 5}; | |
vector<int> ivector(a, a + 5); | |
for(int i = 0; i < ivector.size(); i++) { | |
ivector[i] = i; | |
} | |
print_vector(ivector); | |
cout << a[0]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment