Quick actions

cmd+k|ctrl+k

Navigation

Languages

Vector Adv.

Snippet info

Language

Cpp

Visibility

public

Author

amangoyal1727

Created

2021-01-10T22:53:10Z

Updated

2021-01-10T22:53:10Z

#include<iostream>
#include <bits/stdc++.h> 
using namespace std; 

int main() 
{ 
	vector<int> v = { 50,60,70,80,90}, v1; 
	vector<int>::iterator it; 
           it = v.insert(v.begin(), 40); 
            cout<<*it<<endl;
            cout<<*v.begin();
           it = v.insert(v.begin(), 1, 30); 
   
 	cout << "The vector1 elements are: "; 
	for ( it = v.begin(); it != v.end(); ++it) 
		cout << *it << " ";
		
	cout<<endl;

	v1.insert(v1.begin(),v.begin(),v.end()); 

	cout << "The vector2 elements are: "; 
	for (it = v1.begin(); it != v1.end(); ++it) 
		cout << *it << " "; 
    cout<<endl;
	return 0; 
}
INFO