Fixing whitespace
This commit is contained in:
parent
4a00c12f43
commit
308a10b9ef
@ -3,7 +3,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#define SIZE 1000
|
||||
#define SIZE 100
|
||||
|
||||
|
||||
struct tree{
|
||||
@ -27,7 +27,7 @@ struct tree* read_tree(){
|
||||
char buffer[SIZE];
|
||||
memset(buffer,0,SIZE);
|
||||
char* r = fgets(buffer,SIZE,stdin);
|
||||
if(!r){
|
||||
if(!r) {
|
||||
return NULL;
|
||||
}
|
||||
r[strcspn(r, "\n")] = '\0';
|
||||
@ -42,6 +42,9 @@ struct tree* read_tree(){
|
||||
}
|
||||
node->left = read_tree();
|
||||
node->right = read_tree();
|
||||
// Ak je nacitany riadok listovy uzol ,tak netreba robit nic
|
||||
// inak rekurzivne nacitanie laveho syna
|
||||
// a rekurzivne nacitanie praveho syna
|
||||
return node;
|
||||
}
|
||||
void print_tree(struct tree* tree,int offset){
|
||||
@ -73,6 +76,8 @@ int main(void){
|
||||
|
||||
struct tree* tree = read_tree();
|
||||
char line[SIZE];
|
||||
|
||||
|
||||
while( fgets(line, sizeof(line), stdin)){
|
||||
line[strcspn(line, "\n")] = '\0';
|
||||
if(line[0] == '\0'){
|
||||
@ -81,15 +86,15 @@ int main(void){
|
||||
}
|
||||
|
||||
}
|
||||
if(!whitespace && tree != NULL){
|
||||
printf("No whitespace after database\n");
|
||||
return 0;
|
||||
}
|
||||
//if(!whitespace && tree != NULL){
|
||||
//printf("No whitespace after database\n");
|
||||
// return 0;
|
||||
//}
|
||||
int numOfLeaves = count_leaves(tree);
|
||||
char answer[SIZE];
|
||||
printf("Expert z bufetu to vie.\n");
|
||||
if(tree == NULL){
|
||||
printf("Chybna databaza\n");
|
||||
if(!tree){
|
||||
printf("Chybova databaza\n");
|
||||
return 0;
|
||||
}
|
||||
printf("Pozna %d druhov ovocia a zeleniny.\n", numOfLeaves);
|
||||
@ -128,5 +133,4 @@ int main(void){
|
||||
}
|
||||
}
|
||||
destroy_tree(tree);
|
||||
return 0;
|
||||
}
|
||||
return 0;}
|
||||
Loading…
Reference in New Issue
Block a user