Guten Tag,
für die Hilfe wollte ich mich bedanken indem ich mal die Lösung, bei der mir ein Freund geholfen hat, online stelle, der Tipp oben war zwar hilfreich aber ich wußte nicht das man Sachen wie bei *** schreiben kann.
Bin mir nicht sicher ob alle include nötig sind kann es aber im Moment nicht testen.
Also ich hoffe das hilft etwas, da ich es damals nirgends finden konnte.
|
C Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <list>
#include <iterator>
#include <stdlib.h>
#include <iostream>
#include <cstdlib>
list< list<int> > charList;
for( int i=0; i < 10; i++ ) {
charList.push_front( *(new list<int>) );
charList.front().push_front(rand()); // ***
charList.front().push_front(rand());
charList.front().push_front(rand());
charList.front().push_front(rand());
charList.front().push_front(rand());
charList.front().push_front(rand());
}
// Display the list
list< list<int> >::iterator theOuterIterator;
int i = 0;
for( theOuterIterator = charList.begin(); theOuterIterator != charList.end(); theOuterIterator++ )
{
theOuterIterator->sort();
list<int>::iterator theInnerIterator;
cout << "Liste: " << i << endl;
for( theInnerIterator = theOuterIterator->begin();
theInnerIterator != theOuterIterator->end(); theInnerIterator++ )
{
cout << *theInnerIterator << endl;
}
i++;
}
|