Skip to content

Instantly share code, notes, and snippets.

@ravikiran0606
Created August 21, 2016 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravikiran0606/a9ba2b5fbe449a5701463f87bbb65c18 to your computer and use it in GitHub Desktop.
Save ravikiran0606/a9ba2b5fbe449a5701463f87bbb65c18 to your computer and use it in GitHub Desktop.
C++ Program to implement the use of STL vector :
#include<iostream>
#include<vector>
// Similar to array but useful when the number of elements (size) is unknown...
using namespace std;
int main()
{
vector<int>v;
int t;
cout<<"Enter the numbers ( Number 6 to terminate ) ";
while(1){
cin>>t;
if(t==6)break;
v.push_back(t);
}
cout<<"\nThe entered numbers are..";
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment