#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int>v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
v.push_back(6);
v.push_back(7);
v.push_back(8);
v.push_back(9);
v.push_back(10);
int s = distance(v.begin(), v.end());
cout << "Size of Vector :: " << s << "\n";
auto it = find(v.begin(), v.end(), 7);
if(it != v.end())
{
int dst = distance(v.begin(), it);
cout << "\nDistance :: " << dst << "\n";
}
else
cout << "\n7 Not Found." << "\n";
return 0;
}
Comments
Post a Comment