Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Link.h"
- #include <iostream>
- using namespace std;
- template<typename T>
- void printLList(Link<T> * list)
- {
- while(list != 0)
- {
- cout << list->element << "\n";
- list = list->next;
- }
- }
- int main()
- {
- /*
- List<int> * LinkerHead = new List<int>(1,
- new List<int>(1,
- new List<int>(1,
- new List<int>(1))));
- List<int> * LinkerHead = new List<int>(1);
- LinkerHead->next = new List<int>(2);
- LinkerHead->next->next = new List<int>(3);
- LinkerHead->next->next->next = new List<int>(4);
- */
- Link<int> * link = new Link<int>(1);
- Link<int> * list = link;
- for(int i = 2;i<100;i++, list = list->next)
- {
- list->next = new Link<int>(i);
- }
- printLList(link);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement