Advertisement
Md_hosen_zisad

vector,.iterator in array

Feb 25th, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<vector>
  3. using namespace std;
  4. int main()
  5. {
  6.  
  7. int i,y,p;
  8. vector<int>x;
  9. vector<int>:: iterator k;
  10. cin>>p;
  11. for(i=0;i<p;i++)
  12. {
  13. cin>>y;
  14. x.push_back(y);
  15.  
  16. }
  17. for(k=x.begin();k<x.end();k++)
  18. cout<<*k<<" ";
  19. cout<<endl;
  20.  
  21. for(i=0;i<p;i++)
  22. {
  23. cout<<x[i]<<" ";
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement