Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Vector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
#include <bits/algorithmfwd.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v;
int i;
cout<<"Vector_SIZE_original/initial:"<<v.size()<<endl;//initially the size of vector is =? FIND OUT.
for(int i=0;i<5;i++)
{
v.push_back(i);//push back function is used to insert elements into vector
}
cout<<"Vector_SIZE_EXTENDED:"<<v.size()<<endl;//Vectors differ from array on that they are dynamically sized so here it is to be seen size of vector changes to no. of values inputted.
vector<int>::iterator c= v.begin();//an iterator, moving/iterating over the vector from begining to the end of the vector to show the values stored in it.
while(c!=v.end())
{
cout<<"value of v="<< *c<<endl;
c++;
}


return 0;
}