#include <bits/stdc++.h>
using namespace std;
//STL vector
int main()
{
vector<int> vec;
vector<int> vec1(10);
vector<int> vec2(40, 3);
vec.push_back(5);
vec.push_back(3);
vec.push_back(1);
vec.insert(vec.begin(), 2);
for(vector<int>::iterator itr=vec.begin(); itr!=vec.end(); itr++){
if(*itr == 3){
vec.insert(itr, 77);
break;
}
}
printf("\n");
for(auto x : vec){
printf("%d ", x);
}
vec.pop_back();
vec.erase(vec.begin());
printf("\n");
for(auto x : vec){
printf("%d ", x);
}
printf("\nsize :%d fron :%d rear: %d", vec.size(), vec.front(), vec.back());
vec.assign(5, 4);
printf("\n");
for(auto x : vec){
printf("%d ", x);
}
vec.clear();
vec = vector<int>();
printf("\n");
for(auto x : vec){
printf("%d ", x);
}
return 0;
}
'정보올림피아드-KOI' 카테고리의 다른 글
정올 - visual studio에서 bits/stdc++.h (0) | 2019.12.17 |
---|