#include<iostream>
#include<list>
#include<algorithm>
#include<iterator>
using namespace std;
int main()
{
int r[] = {1,2,3,4,5,6,7,8,9};
list<int>ar(r, r+9);
list<int> :: iterator t;
t = find(ar.begin(), ar.end(), 9);
if(t == ar.end())
{
cout << "Not Found\n";
}
else
{
ar.erase(t);
for(t=ar.begin(); t!=ar.end();t++)
{
cout << *t << "\t";
}
cout << endl;
}
return 0;
}
#include<list>
#include<algorithm>
#include<iterator>
using namespace std;
int main()
{
int r[] = {1,2,3,4,5,6,7,8,9};
list<int>ar(r, r+9);
list<int> :: iterator t;
t = find(ar.begin(), ar.end(), 9);
if(t == ar.end())
{
cout << "Not Found\n";
}
else
{
ar.erase(t);
for(t=ar.begin(); t!=ar.end();t++)
{
cout << *t << "\t";
}
cout << endl;
}
return 0;
}
Comments
Post a Comment