-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.c
131 lines (94 loc) · 1.97 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hash_table.h"
#include "scanner.h"
int main(int argc, char *args[]) {
file_init();
char *word;
printf("starte...\n");
while ((word = next_word()) != NULL) {
struct bucket *result = lookup(word);
if(result == NULL) {
result = (struct bucket *) malloc(sizeof(struct bucket));
}
}
file_close();
return 0;
char key[10];
add("ro", "hier gehts um die stadt rosenheim");
add("grhh", "inhalt für grossholzhausen");
while (1) {
printf("DB-Abfrage: \n");
int result = scanf("%s", key);
if(result == 0) {
printf("Falsches Format!\n");
} else {
struct bucket *result = lookup(key);
if(result == NULL)
printf("no result\n");
else
printf("Value for %s: %s\n", key, result->value);
}
}
}
*/
/*
#include <stdlib.h>
#include <stdio.h>
#include "array_list.h"
#include <string.h>
int main(int argc, const char *argv[]) {
while (1) {
char word[100];
int count;
int result = scanf("%s %d", word, &count);
if(result == 0) {
fflush(stdin);
continue;
}
if (strcmp(word, "info") == 0) {
;
} else {
char *word2 = strdup(word);
list_insert(word2, count);
}
}
}
*/
/*
#include <stdio.h>
#include "bintree.h"
void success(char *name) {
printf("found: %s \n", name);
}
void error(char *bla) {
printf("found nothing :(");
}
typedef void (*Callback)(char *param);
int main (int argc, const char * argv[]) {
printf("starte...\n");
Callback funcs[2] = { success, error };
Ort ltk = { 8, "leutkirch" };
Ort rbl = { 10, "raubling" };
Ort ro = { 6, "rosenheim" };
Ort low = { 5, "low" };
Ort lower = { 1, "lower" };
printf("inserting...\n");
insert(<k);
insert(&rbl);
insert(&ro);
insert(&low);
insert(&lower);
insert_by_properties(12, "new york");
printf("searching...\n");
Ort *result = find(12);
if (result == NULL) {
(*funcs[0])(NULL);
} else {
(*funcs[0])(result->name);
}
return 0;
}
*/