From 8c325a7f76029223ee394ffd97a0b8cd2485e041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Korpesio?= Date: Thu, 7 Oct 2021 21:02:49 +0200 Subject: [PATCH] upload --- cv1/program.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/cv1/program.c b/cv1/program.c index a0f4946..9e70f19 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -1,13 +1,16 @@ +#include #include #include #define LINESIZE 100 - +// Prepáčte za 0 bodov, moja chyba, uloha mi trvá viac času ako som plánoval, preto nestíham odovzdať zadanie správne. Ja pevne verím, že viac krát sa to už nezopakuje a ďalšie zadania už nebudú 0. Korpesio struct Pizza { float prize; char name[LINESIZE]; }; - - +struct hladany { + char item[LINESIZE]; + }; +//int nacitaj(struct pizza* item) //int matches(heap, needle){ // return 0; @@ -24,18 +27,38 @@ int main (){ size_t velkost = 0; char line[LINESIZE]; memset(line, 0, LINESIZE); + + char name[LINESIZE]; + int prvy = 0; + char item[LINESIZE]; + struct hladany nazov; + struct Pizza jedalny_listok; + memset(nazov, 0,sizeof(struct hladany)); + memset(jedalny_listok, 0, sizeof(struct Pizza)*LINESIZE); + int i = 0; //char search_string[LINESIZE] = "Ostiepkova"; - while(1){ - char *r = fgets(line, LINESIZE, stdin); + while(fgets(line, LINESIZE, stdin)){ velkost = strlen(line); - if (r == NULL || velkost == 1){ + if (velkost == 1){ printf("%s", line); break; } + if(prvy==0){ - struct Pizza pizza; - memset(line, 0,sizeof(struct Pizza)); - strcpy(pizza.name, line); + + + strcpy(nazov.item, line); + + printf("%s", nazov.item); + prvy++; + } + if (prvy %2! = 0){ + POCET_JEDAL++; + + strcpy(jedalny_listok.name[i], line); + printf("%s", jedalny_listok.name[i]); + i++; + } //if (matches(search_string. line)){ // printf("%s", pizza->name); //} @@ -46,7 +69,7 @@ int main (){ // printf("%s", pizza->name) // } // - } + return 0;