Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int k=7;
- std::list<int> *mylist = new std::list<int>[k];
- std::list<int>::iterator *it = new std::list<int>::iterator[k];
- for(int i = 0; i < k; i++){
- int k = rand() % 19 + 1;
- it[i] = mylist[i].begin();
- for(int j = 0; j < 10; j++){
- mylist[i].insert(it[i], k+j);
- }
- }
- for(int i = 0; i < k; i++){
- cout<<"Lista " << i <<" : ";
- for(it[i] = mylist[i].begin(); it[i] != mylist[i].end(); it[i]++){
- cout << " "<<*it[i];
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement