t2
This commit is contained in:
parent
13babedc81
commit
e8c25c191c
@ -5,7 +5,7 @@
|
||||
|
||||
#define LINESIZE 100
|
||||
struct pizza {
|
||||
char price[LINESIZE];
|
||||
float price;
|
||||
char name[LINESIZE];
|
||||
};
|
||||
|
||||
@ -33,7 +33,8 @@ int main(){
|
||||
if (strlen(vstup) == 0) {
|
||||
break;
|
||||
}
|
||||
strcpy(menu[count].price, vstup);
|
||||
float cislo = strtof(vstup, NULL);
|
||||
menu[count].price = cislo;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -42,8 +43,7 @@ int main(){
|
||||
qsort (menu, count, sizeof(struct pizza), compare_pizza);
|
||||
for(int i = 0; i < count;i++){
|
||||
printf("%s\n", menu[i].name);
|
||||
float number = strtof(menu[i].price, NULL);
|
||||
printf("%f\n", number);
|
||||
printf("%f\n", menu[i].price);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user