renomeando função e adicionando if's
This commit is contained in:
parent
94483a1540
commit
0789cbf76e
|
@ -1,4 +1,4 @@
|
||||||
int funcaoBalancear () {
|
int funcaoRetorna () {
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
float litro1, teor1, litro1, teor2;
|
float litro1, teor1, litro1, teor2;
|
||||||
|
@ -7,12 +7,14 @@ int funcaoBalancear () {
|
||||||
scanf("%d", &n);
|
scanf("%d", &n);
|
||||||
|
|
||||||
if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) ||
|
if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) ||
|
||||||
(litro1 || teor1 || litro2 || teor2) <= 0) return 0;
|
(litro1 || teor1 || litro2 || teor2) <= 0) return 0; //Se o teor for negativo ou scanf for lido incorretamente
|
||||||
|
|
||||||
|
if((teor1 || teor2) > 1) return 1; // Se o teor for maior que 100%
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
|
|
||||||
funcaoBalancear();
|
funcaoRetorna();
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue