Program for Sorting Containers Implementation in Stl

Sorting Containers

(1)      void sort();
(2) template <class Compare>
        void sort (Compare comp);

Sort elements in container:
Sorts the elements in the list, altering their position within the container.

The sorting is performed by applying an algorithm that uses either operator< (in version (1)) or comp (in version (2)) to compare elements. This comparison shall produce a strict weak ordering of the elements (i.e., a consistent transitive comparison, without considering its reflexiveness).

The resulting order of equivalent elements is stable: i.e., equivalent elements preserve the relative order they had before the call.

The entire operation does not involve the construction, destruction or copy of any element object. Elements are moved within the container.

C++ Program for Sorting Containers Implementation in STL :

#include <iostream>
#include <list>
#include <cstdlib>
using namespace std;
int main()
{
    int choice, item;
    list<int> lt;
    list<int>::iterator it;
    while (1)
    {
        cout<<"n---------------------"<<endl;
        cout<<"Sorting Containers Implementation in Stl"<<endl;
        cout<<"n---------------------"<<endl;
        cout<<"1.Insert Element into the List"<<endl;
        cout<<"2.Display Sorted Elements"<<endl;
        cout<<"3.Exit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter the element to be inserted: ";
            cin>>item;
            lt.push_back(item);
            break;
        case 2:
            lt.sort();
            cout<<"Elements of Sorted List: ";
            for (it = lt.begin(); it != lt.end(); ++it)
                cout <<"  "<< *it;
            cout << endl;
            break;
        case 3:
            exit(1);
            break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

Sample Output :

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 9

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 3

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 5

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 6

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 2

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 1
Enter the element to be inserted: 5

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 2
Elements of Sorted List:   2  3  5  5  6  9

---------------------
Sorting Containers Implementation in Stl

---------------------
1.Insert Element into the List
2.Display Sorted Elements
8.Exit
Enter your Choice: 3


------------------

Queue implementation in STL

QUEUES:

Queues are a type of container adaptor, specifically designed to operate in a FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other.

queues are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container class as its underlying container, providing a specific set of member functions to access its elements. Elements are pushed into the “back” of the specific container and popped from its “front”.

The underlying container may be one of the standard container class template or some other specifically designed container class. This underlying container shall support at least the following operations:

  • empty
  • size
  • front
  • back
  • push_back
  • pop_front

The standard container classes deque and list fulfill these requirements. By default, if no container class is specified for a particular queue class instantiation, the standard container deque is used.

C++ Program for Queue implementation in STL

#include <iostream>
#include <queue>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
    queue<int> q;
    int choice, item;
    while (1)
    {
        cout<<"n---------------------"<<endl;
        cout<<"Queue Implementation in Stl"<<endl;
        cout<<"n---------------------"<<endl;
        cout<<"1.Insert Element into the Queue"<<endl;
        cout<<"2.Delete Element from the Queue"<<endl;
    cout<<"3.Size of the Queue"<<endl;
        cout<<"4.Front Element of the Queue"<<endl;
        cout<<"5.Last Element of the Queue"<<endl;
        cout<<"6.Exit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter value to be inserted: ";
            cin>>item;
            q.push(item);
            break;
        case 2:
            item = q.front();
            q.pop();
            cout<<"Element "<<item<<" Deleted"<<endl;
            break;
        case 3:
        cout<<"Size of the Queue: ";
        cout<<q.size()<<endl;
            break;
        case 4:
            cout<<"Front Element of the Queue: ";
        cout<<q.front()<<endl;
            break;
        case 5:
            cout<<"Back Element of the Queue: ";
            cout<<q.back()<<endl;
            break;
        case 6:
            exit(1);
        break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

Sample Output:

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 9

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 8

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 7

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 6

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 5

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 1
Enter value to be inserted: 4

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 3
Size of the Queue: 6

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 4
Front Element of the Queue: 9

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 5
Back Element of the Queue: 4

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 2
Element 9 Deleted

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 3
Size of the Queue: 5

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 4
Front Element of the Queue: 8

---------------------
Queue Implementation in Stl

---------------------
1.Insert Element into the Queue
2.Delete Element from the Queue
3.Size of the Queue
4.Front Element of the Queue
5.Last Element of the Queue
6.Exit
Enter your Choice: 6


------------------

 

Set implementation in C++ STL

Set

Sets are containers that store unique elements following a specific order.

In a set, the value of an element also identifies it (the value is itself the key, of type T), and each value must be unique. The value of the elements in a set cannot be modified once in the container (the elements are always const), but they can be inserted or removed from the container.

Internally, the elements in a set are always sorted following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
Set containers are generally slower than unordered_set  containers to access individual elements by their key, but they allow the direct iteration on subsets based on their order.

Program for set implementation in C++ STL

#include <iostream>
#include <set>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
    set<int> st;
    set<int>::iterator it;
    int choice, item;
    while (1)
    {
        cout<<"n---------------------"<<endl;
        cout<<"Set Implementation in C++ Stl"<<endl;
        cout<<"n---------------------"<<endl;
        cout<<"1.Insert Element into the Set"<<endl;
        cout<<"2.Delete Element of the Set"<<endl;
        cout<<"3.Size of the Set"<<endl;
        cout<<"4.Find Element in a Set"<<endl;
        cout<<"5.Dislplay by Iterator"<<endl;
        cout<<"6.Exit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter value to be inserted: ";
            cin>>item;
            st.insert(item);
            break;
        case 2:
            cout<<"Enter the element to be deleted: ";
            cin>>item;
            st.erase(item);
            break;
        case 3:
            cout<<"Size of the Set: ";
            cout<<st.size()<<endl;
            break;
        case 4:
        cout<<"Enter the element to be found: ";
        cin>>item;
            it = st.find(item);
        if (it != st.end())
                cout<<"Element "<<*it<<" found in the set" <<endl;
            else
                cout<<"No Element Found"<<endl;
            break;
        case 5:
            cout<<"Displaying Map by Iterator: ";
            for (it = st.begin(); it != st.end(); it++)
            {
                cout << (*it)<<" ";
            }
            cout<<endl;
            break;
        case 6:
            exit(1);
        break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

Sample Output:

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 1

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 2

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 3

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 4

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 5

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 4

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 3

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 2

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 1
Enter value to be inserted: 1

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 3
Size of the Set: 5

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 5
Displaying Map by Iterator: 1 2 3 4 5

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 4
Enter the element to be found: 3
Element 3 found in the set

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 2
Enter the element to be deleted: 5

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 3
Size of the Set: 4

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 5
Displaying Map by Iterator: 1 2 3 4

---------------------
Set Implementation in C++ Stl

---------------------
1.Insert Element into the Set
2.Delete Element of the Set
3.Size of the Set
4.Find Element in a Set
5.Dislplay by Iterator
6.Exit
Enter your Choice: 6


------------------

 

Map implementation in STL

Map

Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.

In a map, the key values are generally used to sort and uniquely identify the elements, while the mapped values store the content associated to this key. The types of key and mapped value may differ, and are grouped together in member type value_type, which is a pair type combining both:

typedef pair<const Key, T> value_type;

Internally, the elements in a map are always sorted by its key following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).

Map containers are generally slower than unordered_map containers to access individual elements by their key, but they allow the direct iteration on subsets based on their order.

The mapped values in a map can be accessed directly by their corresponding key using the bracket operator ((operator[]).

Maps are typically implemented as binary search trees.

C++ Program for implementation of Maps in STL:

#include <iostream>
#include <map>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
    map<char,int> mp;
    map<char, int>::iterator it;
    int choice, item;
    char s;
    while (1)
    {
        cout<<"n---------------------"<<endl;
        cout<<"Map Implementation in Stl"<<endl;
        cout<<"n---------------------"<<endl;
        cout<<"1.Insert Element into the Map"<<endl;
        cout<<"2.Delete Element of the Map"<<endl;
    cout<<"3.Size of the Map"<<endl;
        cout<<"4.Find Element at a key in Map"<<endl;
        cout<<"5.Dislplay by Iterator"<<endl;
        cout<<"6.Count Elements at a specific key"<<endl;
        cout<<"7.Exit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter value to be inserted: ";
            cin>>item;
            cout<<"Enter the key: ";
            cin>>s;
            mp.insert(pair<char,int>(s  ,item));
            break;
        case 2:
            cout<<"Enter the mapped string to be deleted: ";
            cin>>s;
            mp.erase(s);
            break;
        case 3:
        cout<<"Size of Map: ";
        cout<<mp.size()<<endl;
            break;
        case 4:
        cout<<"Enter the key at which value to be found: ";
            cin>>s;
            if (mp.count(s) != 0)
                cout<<mp.find(s)->second<<endl;
            else
                cout<<"No Element Found"<<endl;
            break;
        case 5:
        cout<<"Displaying Map by Iterator: ";
            for (it = mp.begin(); it != mp.end(); it++)
            {
                cout << (*it).first << ": " << (*it).second << endl;
            }
            break;
        case 6:
            cout<<"Enter the key at which number of values to be counted: ";
            cin>>s;
            cout<<mp.count(s)<<endl;
            break;
    case 7:
            exit(1);
        break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

Sample Output:

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 1
Enter value to be inserted: 1
Enter the key: a

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 1
Enter value to be inserted: 2
Enter the key: b

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 1
Enter value to be inserted: 3
Enter the key: c

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 1
Enter value to be inserted: 4
Enter the key: d

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 1
Enter value to be inserted: 5
Enter the key: e

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 3
Size of Map: 5

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 4
Enter the key at which value to be found: a
1

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 5
Displaying Map by Iterator: a: 1
b: 2
c: 3
d: 4
e: 5

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 2
Enter the mapped string to be deleted: c

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 5
Displaying Map by Iterator: a: 1
b: 2
d: 4
e: 5

---------------------
Map Implementation in Stl

---------------------
1.Insert Element into the Map
2.Delete Element of the Map
3.Size of the Map
4.Find Element at a key in Map
5.Dislplay by Iterator
6.Count Elements at a specific key
7.Exit
Enter your Choice: 7


------------------

Vector implementation in STL

Vector:

Vectors are sequence containers representing arrays that can change in size.

Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically by the container.

Internally, vectors use a dynamically allocated array to store their elements. This array may need to be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements to it. This is a relatively expensive task in terms of processing time, and thus, vectors do not reallocate each time an element is added to the container.

C++ Program for Vector implementation in STL:

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
    vector<int> ss;
    vector<int>::iterator it;
    int choice, item;
    while (1)
    {
        cout<<"n---------------------"<<endl;
        cout<<"Vector Implementation in Stl"<<endl;
        cout<<"n---------------------"<<endl;
        cout<<"1.Insert Element into the Vector"<<endl;
        cout<<"2.Delete Last Element of the Vector"<<endl;
        cout<<"3.Size of the Vector"<<endl;
        cout<<"4.Display by Index"<<endl;
        cout<<"5.Dislplay by Iterator"<<endl;
        cout<<"6.Clear the Vector"<<endl;
        cout<<"7.Exit"<<endl;
        cout<<"Enter your Choice: ";
        cin>>choice;
        switch(choice)
        {
        case 1:
            cout<<"Enter value to be inserted: ";
            cin>>item;
            ss.push_back(item);
            break;
        case 2:
            cout<<"Delete Last Element Inserted:"<<endl;
            ss.pop_back();
            break;
        case 3:
            cout<<"Size of Vector: ";
            cout<<ss.size()<<endl;
            break;
        case 4:
            cout<<"Displaying Vector by Index: ";
            for (int i = 0; i < ss.size(); i++)
            {
                cout<<ss[i]<<" ";
            }
            cout<<endl;
            break;
        case 5:
            cout<<"Displaying Vector by Iterator: ";
            for (it = ss.begin(); it != ss.end(); it++)
            {
                cout<<*it<<" ";
            }
            cout<<endl;
            break;
        case 6:
            ss.clear();
            cout<<"Vector Cleared"<<endl;
            break;
        case 7:
            exit(1);
            break;
        default:
            cout<<"Wrong Choice"<<endl;
        }
    }
    return 0;
}

Sample Output:

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 4

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 6

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 3

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 8

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 9

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 1
Enter value to be inserted: 2

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 3
Size of Vector: 6

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 4
Displaying Vector by Index: 4 6 3 8 9 2

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 2
Delete Last Element Inserted:

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 3
Size of Vector: 5

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 5
Displaying Vector by Iterator: 4 6 3 8 9

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 4
Displaying Vector by Index: 4 6 3 8 9

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 6
Vector Cleared

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 3
Size of Vector: 0

---------------------
Vector Implementation in Stl

---------------------
1.Insert Element into the Vector
2.Delete Last Element of the Vector
3.Size of the Vector
4.Display by Index
5.Dislplay by Iterator
6.Clear the Vector
7.Exit
Enter your Choice: 7


------------------