-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.cpp
More file actions
35 lines (29 loc) · 825 Bytes
/
Copy pathsource.cpp
File metadata and controls
35 lines (29 loc) · 825 Bytes
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
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <time.h>
#include "List.h"
//Список из строк aaa->bbb->ccc->ddd
int main() {
int size = 1;
ListNode *head = new ListNode[1];
ListNode *tail;
head->prev = nullptr;
head->next = nullptr;
head->data = "aaa";
head->rand = head;
srand(time(NULL));
head->next = ListNode::push(head, head, "bbb", rand() % size++);
head->next->next = ListNode::push(head, head->next, "ccc", rand() % size++);
head->next->next->next = ListNode::push(head, head->next->next, "ddd", rand() % size++);
tail = head->next->next->next;
List list = List(head, tail, size);
list.Print();
FILE *in, *out;
in = fopen("buf.txt", "wb");
list.Serialize(in);
out = fopen("buf.txt", "rb");
list.Deserialize(out);
list.Print();
system("pause");
}