diff --git a/cv2/program.c b/cv2/program.c index 4046a28..e13a9ae 100644 --- a/cv2/program.c +++ b/cv2/program.c @@ -16,16 +16,35 @@ int main() { struct Pizza jedalny_listok[LINESIZE]; memset(jedalny_listok, 0, sizeof(struct Pizza) * LINESIZE); size_t velkost; + int a = 0; + int i = 0; + float cena; while (fgets(line, LINESIZE, stdin)) { velkost = strlen(line); if (velkost == 1 && line[velkost - 1] == '\n') { break; } - strcpy(jedalny_listok[0].name, line); - printf("%s\n", jedalny_listok[0].name); + if (i == 0) { + strcpy(jedalny_listok[a].name, line); + i++; + a++; + } + else if (i == 1){ + cena = atof(line); + jedalny_listok[a].prize = cena; + i--; + a++; + } + } + for (i = 0; i