Professional Documents
Culture Documents
List 1
List 1
#include<list>
#include<iterator>
#include<algorithm>
int main(){
int arr[]={2,5,3,9,7};
list<int>::iterator it;
//it=mylist.begin();
//cout<<*it; //2
/*for(it=mylist.begin();it!=mylist.end();it++){
cout<<*it<<" ";
} */
/*
it=mylist.begin();
cout<<*it<<endl; //5
cout<<*it<<endl; //3
*/
/*
it=mylist.begin();
for(it=mylist.begin();it!=mylist.end();it++){
cout<<*it<<" "; // 2 7 5 3 9 7
*/
/*
cout<<*it<<endl; //9
for(it=mylist.begin();it!=mylist.end();it++){
*/
/*
it=find(mylist.begin(),mylist.end(),22); //There is no element 22 in the list so it will be
if(it==mylist.end()){
cout<<"Not Found.";
}else{
cout<<"Found.";
*/
/*
it=mylist.begin();
for(it=mylist.begin();it!=mylist.end();it++){
cout<<*it<<" "; 5 3 9 7
*/
/*
for(it=mylist.begin();it!=mylist.end();it++){
cout<<*it<<" "; 2 5 9 7
*/
if(mylist.empty()){
cout<<"Empty";
}else{
cout<<"Filled";
*/
/********************More Functions************************/
/*
cout<<mylist.front()<<endl; //2
cout<<mylist.back()<<endl; //7
*/