This commit is contained in:
Damián Korpesio 2021-10-07 21:02:49 +02:00
parent 40cf04856b
commit 8c325a7f76

View File

@ -1,13 +1,16 @@
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define LINESIZE 100 #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 { struct Pizza {
float prize; float prize;
char name[LINESIZE]; char name[LINESIZE];
}; };
struct hladany {
char item[LINESIZE];
};
//int nacitaj(struct pizza* item)
//int matches(heap, needle){ //int matches(heap, needle){
// return 0; // return 0;
@ -24,18 +27,38 @@ int main (){
size_t velkost = 0; size_t velkost = 0;
char line[LINESIZE]; char line[LINESIZE];
memset(line, 0, 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"; //char search_string[LINESIZE] = "Ostiepkova";
while(1){ while(fgets(line, LINESIZE, stdin)){
char *r = fgets(line, LINESIZE, stdin);
velkost = strlen(line); velkost = strlen(line);
if (r == NULL || velkost == 1){ if (velkost == 1){
printf("%s", line); printf("%s", line);
break; 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)){ //if (matches(search_string. line)){
// printf("%s", pizza->name); // printf("%s", pizza->name);
//} //}
@ -46,7 +69,7 @@ int main (){
// printf("%s", pizza->name) // printf("%s", pizza->name)
// } // }
// //
}
return 0; return 0;