Initializacia

This commit is contained in:
Kozar 2024-10-02 12:33:13 +00:00
parent 831b080f14
commit d0d1dc2420

View File

@ -4,15 +4,15 @@
#include <string.h> #include <string.h>
#define LINESIZE 100 #define LINESIZE 100
#define MENU_SiZE 100 #define MENU_SIZE 100
struct pizza{ struct pizza {
char name[LINESIZE]; char name[LINESIZE];
float price; float price;
} };
char hacker_script(char l){ char hacker_script(char l) {
switch(tolower(char l)){ switch (tolower(l)) {
case 'o': return '0'; case 'o': return '0';
case 'i': return '1'; case 'i': return '1';
case 'z': return '2'; case 'z': return '2';
@ -22,7 +22,7 @@ char hacker_script(char l){
case 'b': return '6'; case 'b': return '6';
case 't': return '7'; case 't': return '7';
case 'q': return '9'; case 'q': return '9';
default: return tolower(c); default: return tolower(l);
} }
} }
@ -48,7 +48,6 @@ int read_pizza(struct pizza *item) {
if (!fgets(item->name, LINESIZE, stdin)) { if (!fgets(item->name, LINESIZE, stdin)) {
return 0; return 0;
} }
item->name[strcspn(item->name, "\n")] = '\0'; item->name[strcspn(item->name, "\n")] = '\0';
if (!fgets(line, LINESIZE, stdin)) { if (!fgets(line, LINESIZE, stdin)) {
@ -65,8 +64,9 @@ int main() {
int count = 0; int count = 0;
printf("Zadaj hladanu surovinu:\n"); printf("Zadaj hladanu surovinu:\n");
fgets(search, LINESIZE, stdin); fgets(search, LINESIZE, stdin);
search[strcspn(search, "\n")] = '\0'; search[strcspn(search, "\n")] = '\0';
printf("Zadaj jedalny listok:\n"); printf("Zadaj jedalny listok:\n");
@ -83,8 +83,8 @@ int main() {
found_count++; found_count++;
} }
} }
printf("Nacitanych %d poloziek.\n", count);s printf("Nacitanych %d poloziek.\n", count);
return 0; return 0;
} }