Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <list>
- using namespace std;
- bool fun(int x, int tmp)
- {
- if(x == tmp)
- return true;
- else return false;
- }
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- list <int> myList;
- int n;
- in >> n;
- int z;
- int temp;
- int count = 0;
- for(int i = 0; i < n; i++)
- {
- in >> z;
- myList.push_back(z);
- }
- in >> temp;
- /*for(list<int>::iterator iter = myList.begin(); iter != myList.end(); iter++)
- {
- if (*iter == temp)
- {
- iter = myList.erase(iter);
- iter--;
- count ++;
- }
- } */
- /*myList.remove_if(bind2nd(ptr_fun(fun), temp));
- if(count == 0)*/
- /*out << "There is not elements equal " << temp << "!" << endl;*/
- myList.remove(temp);
- while(!myList.empty())
- {
- out << myList.front() << " ";
- myList.pop_front();
- }
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement