Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- using namespace std;
- vector<int>vec1,vec3;
- vector<int>vec2[100];
- vector<string>str;
- int main()
- {
- int k=0;
- while(k<2)
- {
- string s="Pabon",s1="Toufiq",s2="Shawon",s3="Bidhan";
- vec1.push_back(1);
- vec1.push_back(2);
- vec1.push_back(3);
- vec1.push_back(4);
- vec3=vec1;
- cout<<"\nPrint 1D array\n\n";
- for(int i=0; i<vec1.size(); i++)
- {
- cout<<" "<<vec1[i];
- }
- cout<<"\n";
- vec1.pop_back();
- for(int i=0; i<vec1.size(); i++)
- {
- cout<<" "<<vec1[i];
- }
- cout<<"\n";
- vec2[0].push_back(4);
- vec2[0].push_back(5);
- vec2[0].push_back(6);
- vec2[1].push_back(9);
- vec2[1].push_back(10);
- vec2[2].push_back(11);
- cout<<"\nPrint 2D array\n\n";
- for(int i=0; i<3; i++)
- {
- for(int j=0; j<vec2[i].size(); j++)
- {
- cout<<" "<<vec2[i][j];
- }
- cout<<endl;
- }
- cout<<"\nPrint string\n\n";
- str.push_back(s);
- str.push_back(s1);
- str.push_back(s2);
- str.push_back(s3);
- for(int i=0; i<str.size(); i++)
- {
- cout<<str[i]<<endl;
- }
- vec1.clear();
- vec2[0].clear();
- vec2[1].clear();
- vec2[2].clear();
- vec3.clear();
- str.clear();
- k++;
- cout<<"\n\n----------\n\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment