rnrjs
This commit is contained in:
parent
8bd0ab5c62
commit
f6ab3ecefd
@ -30,10 +30,7 @@ struct tree* read_tree(){
|
|||||||
if(!r) {
|
if(!r) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
buffer[strcspn(r, "\n")] = '\0';
|
buffer[strcspn(buffer, "\n")] = '\0';
|
||||||
if(buffer[0] == '\0'){
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
struct tree* node = calloc(1,sizeof(struct tree));
|
struct tree* node = calloc(1,sizeof(struct tree));
|
||||||
memcpy(node->value,buffer,SIZE);
|
memcpy(node->value,buffer,SIZE);
|
||||||
if(buffer[0] == '*'){
|
if(buffer[0] == '*'){
|
||||||
@ -76,17 +73,15 @@ int main(void){
|
|||||||
struct tree* tree = read_tree();
|
struct tree* tree = read_tree();
|
||||||
char line[SIZE];
|
char line[SIZE];
|
||||||
|
|
||||||
|
|
||||||
while( fgets(line, sizeof(line), stdin)){
|
|
||||||
if(strcmp(line, "\n") == 0){
|
|
||||||
whitespace = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
int numOfLeaves = count_leaves(tree);
|
int numOfLeaves = count_leaves(tree);
|
||||||
char answer[SIZE];
|
char answer[SIZE];
|
||||||
bool exs = false;
|
while (fgets(line, sizeof(line), stdin)) {
|
||||||
|
line[strcspn(line, "\n")] = '\0';
|
||||||
|
if (line[0] == '\0') {
|
||||||
|
whitespace = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
printf("Expert z bufetu to vie.\n");
|
printf("Expert z bufetu to vie.\n");
|
||||||
if(!tree || !whitespace){
|
if(!tree || !whitespace){
|
||||||
printf("Chybna databaza\n");
|
printf("Chybna databaza\n");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user