du2 - 10
This commit is contained in:
parent
19ef0dec39
commit
0e32584893
@ -30,11 +30,12 @@ int read_pizza(struct pizza *item) {
|
||||
return 0;
|
||||
}
|
||||
line2[strcspn(line2, "\n")] = '\0';
|
||||
|
||||
|
||||
float value;
|
||||
if (sscanf(line2, "%f", &value) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
strncpy(item->name, line1, LINESIZE - 1);
|
||||
item->name[LINESIZE - 1] = '\0';
|
||||
return 1;
|
||||
@ -75,13 +76,12 @@ int main() {
|
||||
list[count++] = tmp;
|
||||
}
|
||||
|
||||
//triedenie
|
||||
sort_pizzas(list, count);
|
||||
|
||||
//vypis listka
|
||||
for (int i = 0; i < count; i++){
|
||||
printf("%s\n", list[i].name);
|
||||
printf("%.6f\n", list[i].price);
|
||||
if (count > 0) {
|
||||
sort_pizzas(list, count);
|
||||
for (int i = 0; i < count; i++){
|
||||
printf("%s\n", list[i].name);
|
||||
printf("%.6f\n", list[i].price);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user