I have a program to introduce temperatures, and I need to ask what scale he wants to insert the data, and then receive a list of temperatures. Then I need to convert that list.
But what would I put for a stop condition in the while
since 0
can be a temperature?
int main(int argc, char const *argv[]) {
int n = 0;
int temperaturas[TAMANHO];
char escala;
printf("Escala: ");
scanf("%c", &escala);
puts("Para PARAR Prima 0");
while (temperaturas[n - 1] != 0) {
if (escala == 'C') {
printf("\n\tCelcius: ");
scanf("%d", &temperaturas[n]);
} else
if (escala == 'K') {
printf("\n\tKelvin: ");
scanf("%d", &temperaturas[n]);
}
n++;
}
escreverTemperaturas(temperaturas, escala, n);
return 0;
}