Experimenting with assignments

This commit is contained in:
Abreu 2021-09-11 19:47:58 -03:00
parent 43c3b41498
commit e052dbd910
No known key found for this signature in database
GPG Key ID: 64835466FF55F7E1
1 changed files with 6 additions and 10 deletions

View File

@ -18,25 +18,21 @@ bool readInput(Barrel * line, Barrel * reservoir) {
if (i % 2 == 0) {
line[i / 2].no = i / 2 + 1;
line[i / 2].juice = f;
continue;
}
else {
if (f > 1)
return false;
line[i / 2].alcohol = f * line[i / 2].juice;
line[i / 2].juice -= line[i / 2].alcohol;
reservoir->juice += line[i / 2].juice;
reservoir->alcohol += line[i / 2].alcohol;
}
if (f > 1)
return false;
reservoir->alcohol += line[i / 2].alcohol = f * line[i / 2].juice;
reservoir->juice += line[i / 2].juice -= line[i / 2].alcohol;
}
return true;
}
void sortLine(Barrel * line) {
Barrel aux;
Barrel aux = line[0];
if (line[0].juice + line[0].alcohol > line[1].juice + line[1].alcohol)
return;
aux = line[0];
line[0] = line[1];
line[1] = aux;
}