-
Notifications
You must be signed in to change notification settings - Fork 0
/
tema_1.c
66 lines (62 loc) · 1.96 KB
/
tema_1.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
#include "eliminare.h"
int main(int argc, char **argv)
{
double_nod *head = NULL;
int n;
scanf("%d", &n);
head = CreateDoubleList(head, n);
int ok = 1;
for (int i = 1; i < argc; i++)
{
if (strcmp("--e1", argv[i]) == 0 || strcmp("e1", argv[i]) == 0)
{
RemoveExceptions(head, &n);
}
else if (strcmp("--e2", argv[i]) == 0 || strcmp("e2", argv[i]) == 0)
{
head = FiltrareMediana(head, &n);
}
else if (strcmp("--e3", argv[i]) == 0 || strcmp("e3", argv[i]) == 0)
{
head = FiltrareAritmetica(head, &n);
// PrintList(head);
}
else if (strcmp("--u", argv[i]) == 0 || strcmp("u", argv[i]) == 0)
{
head = UniformizareFrecvente(head, &n);
}
else if ((strcmp("--c", argv[i]) == 0) || (strcmp("c", argv[i]) == 0))
{
head = CompletareDate(head, &n);
}
else
{
int interval;
if (argv[i][0] == '-' && argv[i][1] == '-' && argv[i][2] == 's' && argv[i][3] == 't')
{
char *temp_string = (char *)calloc(strlen(argv[i]), sizeof(char));
strcpy(temp_string, argv[i] + 4);
interval = atoi(temp_string);
free(temp_string);
ok = 0;
}
else if (argv[i][0] == 's' && argv[i][1] == 't')
{
char *temp_string = (char *)calloc(strlen(argv[i]), sizeof(char));
strcpy(temp_string, argv[i] + 2);
interval = atoi(temp_string);
free(temp_string);
ok = 0;
}
head = statistici(head, &n, interval);
}
}
// on last task you wont have to print the list
if (ok == 1)
{
printf("%d\n", n);
PrintList(head);
}
free_list(&head);
return 0;
}