This commit is contained in:
Radovan Kofira 2020-10-04 22:26:40 +02:00
parent 0833dd70ed
commit 9975be5199
2 changed files with 14 additions and 7 deletions

View File

@ -10,14 +10,14 @@ struct pizza {
float prize;
char name[LINESIZE];
};
int search_string(const char* heap, const char* needle);
int read_pizza(struct pizza* item);
char hacker_script(char c);
int main(){
struct pizza jedalny_listok[POCET_JEDAL];
memset(jedalny_listok, 0,sizeof(struct pizza)*POCET_JEDAL);
int counter;
char line[LINE_SIZE];
memset(line,0,LINE_SIZE);
printf("Zadaj hladanu surovinu:\n");
@ -25,13 +25,20 @@ int main(){
if(r != NULL && line[1] != 0){
printf("Zadaj jedalny listok\n");
struct pizza item;
int counter = 1;
counter = 1;
while(read_pizza(&item)){
strcpy(jedalny_listok[counter-1].name, item.name);
jedalny_listok[counter-1].prize=item.prize;
counter += 1;
}
}
for(int i=0;i<counter;i++){
if(search_string(jedalny_listok[i].name,line)!=-1){
printf("%s\n",jedalny_listok[i].name);
printf("%.2f\n",jedalny_listok[i].prize);
}
}
printf("Nacitanych %d poloziek",counter);
}
int search_string(const char* heap, const char* needle){

Binary file not shown.