Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <List>
- using namespace std;
- /////////////////////////////////////////////
- int main()
- {
- list <int> q;
- // * * * * *
- int mas[20] = { 3, 2, 44, 5, 65, 32, 11, 20, 84, 32,
- 33, 22, 42, 53, 35, 31, 14, 26, 24, 442 };
- list<int>::iterator it;
- it = q.begin();
- for (int i = 0; i < 20; i++)
- {
- if (i % 2 != 0)
- {
- q.push_back(mas[i]);
- }
- }
- cout << "Size of q = " << q.size() << endl;
- int i = 0;
- while (i <= q.size())
- {
- cout << *it << endl;
- i++;
- it++;
- }
- /*
- while (it != q.end())
- {
- cout << *it << endl;
- i++;
- it++;
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement