List_ArrayList1.htm |
Objectives: :
|
Script : Java
|
Runtime View: Java |
Script : C++#include <iostream> #include <list> #include <string> using namespace std; int main() { string str1[] = {"A", "B", "C","D"}; list <string> Lstr1(str1, str1+4); // cout<<"\n Lstr1.size() : " << Lstr1.size() <<endl; list<string>:: iterator it; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } if(Lstr1.size()>=4) { cout<<"\n need to be resized"; Lstr1.resize(3); } cout<<"\n Lstr1.size() : " << Lstr1.size() <<endl; return 0; }
|
Runtime View : C++
|