alal
This commit is contained in:
parent
87956030eb
commit
053e0ebb83
@ -21,7 +21,7 @@ int porovnaj(const void *a,const void *b){
|
||||
if(p1->price > p2-> price) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return strcmp(p1->meno, p2->meno);
|
||||
}
|
||||
int main() {
|
||||
struct pizza list[LIST_SIZE];
|
||||
@ -36,7 +36,7 @@ int main() {
|
||||
}
|
||||
meno_buf[strcspn(meno_buf, "\n")] = 0;
|
||||
if(!fgets(cena_buf, LINE_SIZE, stdin)) break;
|
||||
cena_buf[strcspn(cena_buf, "zn")] = 0;
|
||||
cena_buf[strcspn(cena_buf, "\n")] = 0;
|
||||
if ( strlen(cena_buf) == 0) {
|
||||
break;
|
||||
}
|
||||
@ -44,14 +44,14 @@ int main() {
|
||||
if (sscanf(cena_buf, "%f", &cena) != 1 || cena == 0) {
|
||||
break;
|
||||
}
|
||||
strncpy(list[buf].meno, meno_buf, LINE_SIZE);
|
||||
strncpy(list[buf].name, meno_buf, LINE_SIZE);
|
||||
list[buf].price= price;
|
||||
count++;
|
||||
}
|
||||
qsort(list, buf, sizeof(struct pizza), porovnaj);
|
||||
|
||||
for(int i = 0; i < buf;i++){
|
||||
prinf("%s\n%.6f\n", list[i].meno, list[i].cena
|
||||
printf("%s\n%.6f\n", list[i].name, list[i].price);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user