This commit is contained in:
Radovan Kofira 2020-10-04 21:54:55 +02:00
parent 954495da68
commit 0833dd70ed
2 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@
#define LINESIZE 100 #define LINESIZE 100
#define LINE_SIZE 100 #define LINE_SIZE 100
#define POCET_JEDAL 100
struct pizza { struct pizza {
float prize; float prize;
char name[LINESIZE]; char name[LINESIZE];
@ -14,20 +14,22 @@ struct pizza {
int read_pizza(struct pizza* item); int read_pizza(struct pizza* item);
char hacker_script(char c); char hacker_script(char c);
int main(){ int main(){
int POCET_JEDAL=0;
struct pizza jedalny_listok[POCET_JEDAL]; struct pizza jedalny_listok[POCET_JEDAL];
memset(jedalny_listok, 0,sizeof(struct pizza)*POCET_JEDAL); memset(jedalny_listok, 0,sizeof(struct pizza)*POCET_JEDAL);
char line[LINE_SIZE]; char line[LINE_SIZE];
memset(line,0,LINE_SIZE); memset(line,0,LINE_SIZE);
printf("Zadaj hladanu surovinu:\n");
char* r = fgets(line,LINE_SIZE,stdin); char* r = fgets(line,LINE_SIZE,stdin);
if(r != NULL && line[1] != 0){ if(r != NULL && line[1] != 0){
printf("Zadaj jedalny listok\n");
struct pizza item; struct pizza item;
int counter = 1; int counter = 1;
while(read_pizza(&item)){ while(read_pizza(&item)){
strcpy(jedalny_listok[counter-1].name, item.name);
jedalny_listok[counter-1].prize=item.prize;
counter += 1; counter += 1;
printf("%s",item.name);
printf("%.2f\n",item.prize);
} }
} }
} }

Binary file not shown.