Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <list>
- using namespace std;
- int main (void)
- {
- ifstream in("input.txt");
- list <int> ls;
- list <int>::iterator i;
- int a;
- bool b = true;
- while (in >> a)
- {
- ls.push_back(a);
- }
- for (i = ls.begin(); i != ls.end();)
- {
- a = *i;
- if (a % 3 == 0)
- {
- i = ls.erase(i);
- b = false;
- break;
- }
- else i++;
- }
- if (b == false)
- for (i = ls.begin(); i != ls.end(); i++)
- cout << *i << " ";
- else cout << "No elem" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment