diff --git a/a2/program.c b/a2/program.c index c44595b..11d5821 100644 --- a/a2/program.c +++ b/a2/program.c @@ -9,7 +9,7 @@ struct stack{ int size; }stack; -///add bracket to stack +///add bracket to stack and increment size void push(char ch){ if(stack.size < 100){ @@ -102,7 +102,7 @@ int main(){ } else{ c_bracket[f] = 0; //if closing bracket is correct then reducee array - f--; //if i didn't find a correct bracket, then keep it in the array + f--; //if i didn't find a correct bracket, then keep it in the array c_bracket pop(); } } diff --git a/cv1/program.c b/cv1/program.c index 4745d9b..4860371 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -9,6 +9,8 @@ struct pizza{ float prize; }; +//read menu + int read_pizza(struct pizza* item){ char line1[LINESIZE]; @@ -16,19 +18,22 @@ int read_pizza(struct pizza* item){ memset(line1, 0, LINESIZE); memset(line2, 0, LINESIZE); - char *l1 = fgets(line1,LINESIZE,stdin); - char *l2 = fgets(line2,LINESIZE,stdin); - float value = strtof(line2, &l2); + char *l1 = fgets(line1,LINESIZE,stdin); //read first line(name) + char *l2 = fgets(line2,LINESIZE,stdin); //read second line(price) + float value = strtof(line2, &l2); //change char to float, because price is a nummber if(value == 0.0F){ return 0; } - if(l1 != NULL && line1[1] != 0){ + if(l1 != NULL && line1[1] != 0){ //check if array with name is not empty item->prize = value; strcpy(item->name, line1); return 1; } } +//check every place where the string might be +//if there isn't at first place, go to the second etc. + int search_string(const char* heap, const char* needle){ int H = strlen(heap); @@ -100,11 +105,14 @@ int main(){ int i, j; for(i = 0; i < counter; i++){ for(j = 0; j < strlen(jedalny_listok[i].name); j++){ + //change menu with help of hacher_script pomocny[i].name[j] = hacker_script(jedalny_listok[i].name[j]); } + //check if there is key in the menu int result = search_string(pomocny[i].name, key); if(result != -1){ + //if there is a key, print name and price printf("%s", jedalny_listok[i].name); printf("%.2f\n", jedalny_listok[i].prize); } diff --git a/cv5/a_train.h b/cv5/a_train.h index 4088b1d..0297dfa 100644 --- a/cv5/a_train.h +++ b/cv5/a_train.h @@ -40,7 +40,7 @@ void print_train(struct car* first); * Zrusenie vsetkych voznov vo vlaku. * @arg smernik na prvy vozen */ -void cancel_train(struct car* first, int val); +void cancel_train(struct car* first); /** * Vyradenie vsetkych voznov, ktorych cielova stanica je target