Posts

Showing posts with the label vector

vector in c++

  vector in c++ code: #include<iostream> #include<vector>  // vector header file #include<algorithm> // This header file contain sort method using namespace std; int main() { vector <int> v; // Declaration of vector int v.push_back(10); v.push_back(30); v.push_back(20);   // To insert element into vector v.push_back(90); v.push_back(50); int size = v.size(); // To get size of Vector cout<<"Size of Vector : "<<size<<endl; // sort the element of vector sort(v.begin(),v.end()); // TO sort we have to pass two parameter                           //which are first element and second element                           v.pop_back();  // To Delete Elements from Array v.pop_back(); size = v.size(); // To get size of Vector cout<<"Size of Vector : "...