Program-11: Aim: C++ Program Which Shows The Usage of Standard
Program-11: Aim: C++ Program Which Shows The Usage of Standard
CODE:
#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<iterator>
using namespace std;
int main() {
vector<int>v(5,0);
for(int t=0;t<5;++t)
cin>>v[t];
v.push_back(5);
v.push_back(6);
cout<<v.size()<<endl;
vector<int>::iterator itr;
21 | 2 k 1 8 / S E / 0 1 4
itr=find(v.begin(),v.end(),5);
if(itr!=v.end())
cout<<itr-v.begin()+1<<endl;
map<int,int>mp;
for(int t=0;t<5;++t)
mp[v[t]]++;
map<int,int>::iterator ptr;
ptr=mp.find(2);
if(ptr!=mp.end())
mp.erase(ptr);
ptr=mp.lower_bound(6);
cout<<ptr->first<<" "<<ptr->second<<endl;
mp.clear();
cout<<mp.size();
return 0;
}
OUTPUT:
22 | 2 k 1 8 / S E / 0 1 4