#include #include #include // compare insert in string and list iterator insert using namespace std; //string_insert_list_iteration1.cpp int main() { cout<<"\n compare string insert with other operations "; string str1, str2, str3, temp; str1= "Hello World"; str2 ="Good World "; str3 ="Cloud Space"; string strarray[] = { str1, str2, str3}; cout<<"\n using equation \n\ttemp = str1.insert(0,str2); "; temp = str1.insert(0,str2); cout<< "\n \t" << temp; temp =""; cout<< "\n Clearing temp " << temp; cout<<"\n using equation \n\t temp = str3 + " "+str2; "; temp = str3 + " "+str2; cout<< "\n \t" << temp; temp =""; cout<< "\n Clearing temp " << temp; cout<<"\n using equation \n\t temp.insert(0, str3,0, string::npos);"; temp.insert(0, str3,0, string::npos); cout<< "\n \t" << temp; temp =""; cout<< "\n Clearing temp " << temp; cout<<"\n using equation \n\t temp.insert(0, str3,5, string::npos); "; temp.insert(0, str3,5, string::npos); cout<< "\n \t" << temp; temp =""; cout<< "\n Clearing temp " << temp; cout<<"\n using list Lstr1(strarray, strarray+3); "; list Lstr1(strarray, strarray+3); cout<<"\n Lstr1.size() : " << Lstr1.size() <:: iterator it; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } return 0; }