This commit is contained in:
Damián Korpesio 2021-10-14 17:29:39 +02:00
parent 1f4f88feac
commit 3b4e248bf6

View File

@ -20,10 +20,7 @@ int main() {
int i = 0; int i = 0;
int c; int c;
int d; int d;
float pred;
float cena; float cena;
char strpred[LINESIZE];
memset(strpred,0,LINESIZE);
while (fgets(line, LINESIZE, stdin)) { while (fgets(line, LINESIZE, stdin)) {
velkost = strlen(line); velkost = strlen(line);
if (velkost == 1 && line[velkost - 1] == '\n') { if (velkost == 1 && line[velkost - 1] == '\n') {
@ -37,6 +34,9 @@ int main() {
} }
else if (i == 1){ else if (i == 1){
cena = atof(line); cena = atof(line);
if (cena == 0.0){
break;
}
jedalny_listok[a].prize = cena; jedalny_listok[a].prize = cena;
i--; i--;
@ -49,8 +49,8 @@ int main() {
// a = a / 2; // a = a / 2;
//printf("%d", a); //printf("%d", a);
for (c = 0; c < a-1; c++){ for (c = 0; c < a - 1; c++){
for (d = 0; d < a - c-1; d++){ for (d = 0; d < a - c - 1; d++){
if(jedalny_listok[d].prize == jedalny_listok[d+1].prize){ if(jedalny_listok[d].prize == jedalny_listok[d+1].prize){
if(strcmp(jedalny_listok[d].name, jedalny_listok[d+1].name) > 0){ if(strcmp(jedalny_listok[d].name, jedalny_listok[d+1].name) > 0){
struct Pizza tmp; struct Pizza tmp;