Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.