#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
vector<int> temp;
cout << "inserting elements in vectors" << endl;
for( int i = 0; i < 3; i++ )
{
temp.push_back(i);
}
// here we are using latest C++11 range based for loop
// https://www.geeksforgeeks.org/range-based-loop-c/
for( int count: temp )
{
cout << count << endl;
}
cout << "using insert" << endl;
temp.insert( temp.begin(), 10 );
for( int count: temp )
{
cout << count << endl;
}
cout << "using at" << endl;
temp.at(0) = 111;
for( int count: temp )
{
cout << count << endl;
}
cout << "using []" << endl;
temp[0] = 222;
for( int count: temp )
{
cout << count << endl;
}
auto it = find(temp.begin(), temp.end(), 2);
if (it != temp.end())
{
int index = it - temp.begin();
cout << "element found at" << index << endl;
}
else
{
cout << "element not found" << endl;
}
return 0;
}