program.c

This commit is contained in:
an760cw 2023-09-30 16:07:46 +02:00
parent 836a695681
commit df9ffd1438

View File

@ -16,7 +16,7 @@ int read_pizza(struct pizza* element);
void transform(char* str);
int main() {
struct pizza jedalny_listok[5]; // Použité priamo číslo 5 namiesto POCET_JEDAL
struct pizza jedalny_listok[5];
memset(jedalny_listok, 0, sizeof(struct pizza) * 5);
int counter = 0;
@ -26,7 +26,10 @@ int main() {
printf("Zadaj hladanu surovinu:\n");
fgets(line, LINESIZE, stdin);
//trim(line);
int len = strlen(line);
if (len > 0 && line[len - 1] == '\n') {
line[len - 1] = '\0'; // Odstráňye znak nového riadku
}
if (strlen(line) > 1) {
printf("Zadaj jedalny listok:\n");
@ -37,7 +40,7 @@ int main() {
jedalny_listok[counter].price = element.price;
counter++;
if (counter >= 5) { // Použité priamo číslo 5 namiesto POCET_JEDAL
if (counter >= 5) {
break;
}
}
@ -59,13 +62,6 @@ int main() {
return 0;
}
//void trim(char* str) {
//int i = 0;
//while (str[i] != '\n' && str[i] != 0) {
//i++;
//}
//str[i] = 0;
//}
int search_string(const char* a, const char* b) {
int c = strlen(b);