Rename main
This commit is contained in:
parent
94483a1540
commit
672ded260c
|
@ -0,0 +1,18 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
int balancear() {
|
||||
int i, barrels[4], sortedBarrels[4], reservoir[2], isBigger;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
if (!scanf(" %f", barrels[i]) || barrels[i] <= 0)
|
||||
return -1;
|
||||
|
||||
reservoir[0] = barrels[0] + barrels[2]
|
||||
|
||||
sortedBarrels = sortBarrels(barrels)
|
||||
isBigger = (barrels[1] == sortedBarrels[1]) ? 1 : 2;
|
||||
|
||||
for (i = 0; i < 4; i += 2) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,18 +1,34 @@
|
|||
int funcaoBalancear () {
|
||||
|
||||
int n;
|
||||
float litro1, teor1, litro1, teor2;
|
||||
|
||||
printf("Quantos barris você quer balancear?");
|
||||
scanf("%d", &n);
|
||||
|
||||
if(!(scanf("%f %f %f %f", &litro1, &teor1, &litro2, &teor2)) ||
|
||||
(litro1 || teor1 || litro2 || teor2) <= 0) return 0;
|
||||
|
||||
}
|
||||
#include <stdio.h>
|
||||
#include "./balancear.c"
|
||||
|
||||
int main () {
|
||||
int i, n;
|
||||
|
||||
funcaoBalancear();
|
||||
printf("Este programa recebe valores de volume e concentração de álcool para um par de barris, efetuando uma mistura que deixa um ou ambos os barris, com concentração de 14 por cento de álcool\n Digite quantos barris pretende-se balancear: ");
|
||||
if (!scanf(" %d", &n) || n <= 0) {
|
||||
printf("Valor inválido\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
printf("\nDigite os valores de volume e concentração para ambos o barris do %dº par, respectivamente: ", i);
|
||||
switch (balancear()) {
|
||||
case -1:
|
||||
printf("Valores inválidos\n");
|
||||
return 1;
|
||||
case 0:
|
||||
printf("Assim n vai dar. A bebida tem que estar perfeita!\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("Hehe, esse aqui ta no ponto. Guardem o barril 1 para depois\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Hehe, esse aqui ta no ponto. Guardem o barril 2 para depois\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Hehe, esse aqui ta no ponto.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include "./balancear.c"
|
||||
|
||||
int main () {
|
||||
int i, n;
|
||||
|
||||
printf("Este programa recebe valores de volume e concentração de álcool para um par de barris, efetuando uma mistura que deixa um ou ambos os barris, com concentração de 14 por cento de álcool\n Digite quantos barris pretende-se balancear: ");
|
||||
if (!scanf(" %d", &n) || n <= 0) {
|
||||
printf("Valor inválido\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
printf("\nDigite os valores de volume e concentração para ambos o barris do %dº par, respectivamente: ", i);
|
||||
switch (funcaoRetorna()) {
|
||||
case -1:
|
||||
printf("Valores inválidos\n");
|
||||
return 1;
|
||||
case 0:
|
||||
printf("Assim n vai dar. A bebida tem que estar perfeita!\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("Hehe, esse aqui ta no ponto. Guardem o barril 1 para depois\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Hehe, esse aqui ta no ponto. Guardem o barril 2 para depois\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Hehe, esse aqui ta no ponto.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue