This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.c
76 lines (65 loc) · 1.46 KB
/
main.c
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Вот тута пишем сишные импорты.
#include <stdio.h>
// Вот тута пишем локальные инклюды.
#include "linked_list.h"
#include "stack.h"
#include "stack_queue.h"
/*
Создали бы уже мейн в конце концов................
*/
void test_linked_list()
{
int cur = 0;
linked_list* head = calloc(1, sizeof(linked_list));
while (!feof(stdin))
{
if (fscanf(stdin, "%d", &cur) != 1)
break;
push(head, cur);
}
print(head);
}
void test_stack()
{
stack res = stack_new();
while (!feof(stdin))
{
int cur = 0;
if (fscanf(stdin, "%d", &cur) != 1)
break;
stack_push(res,cur);
}
while(stack_len(res)!=0)
{
printf("%d \n", stack_pop(res));
}
}
void test_dynamic_array()
{
int cur = 0;
dyn_arr* da = calloc(1, sizeof(dyn_arr));
while (!feof(stdin))
{
if (fscanf(stdin, "%d", &cur) != 1)
break;
push(da, cur);
}
}
void test_stack_queue()
{
struct stack_queue q = stack_queue_new();
stack_queue_push(q, 1);
stack_queue_push(q, 2);
printf("%d ", stack_queue_pop(q));
stack_queue_push(q, 3);
printf("%d ", stack_queue_pop(q));
printf("%d ", stack_queue_pop(q));
}
int main()
{
//test_linked_list();
//test_stack();
//test_dynamic_array();
test_stack_queue();
return 0;
}