1
I’m solving an exercise in logic and I can’t understand the error:
#include <stdio.h>
#include <stdlib.h>
int main(){
int TotalVinhos=0, t=0, b=0, r=0, fim = 0;
//float Porc;
char tipo;
while(fim == 0){
printf("Tipo do vinho: ");
scanf("%c", &tipo);
switch(tipo){
case 'T':
t++;
TotalVinhos++;
break;
case 'B':
b++;
TotalVinhos++;
break;
case 'R':
r++;
TotalVinhos++;
break;
case 'F':
fim = 1;
break;
default:
printf("erro..");
break;
}
}
printf("Total de vinhos: %d\n", TotalVinhos);
printf("Quantida de vinho tipo T: %d\n", t);
printf("Quantida de vinho tipo B: %d\n", b);
printf("Quantida de vinho tipo R: %d", r);
}
The error presented to me:
This code does not even compile, at least in a decent compiler. Even this code cannot give the result shown. If you put one code and are using another it becomes complicated to help.
– Maniero
Which compiler is decent?
– WSS
@bigown see, I changed the code.. now it’s to compile but keep the error there
– WSS
It got worse. You have to post something that you know is at least compiling.
– Maniero
I fixed the errors, gave an organized, but I kept the essence of the code and is working. http://ideone.com/ohtaSe
– Maniero
I tested the code I just got on repl.it and ran but with the bug
– WSS
The code you posted is also with the same error:
– WSS
Not for me https://i.stack.Imgur.com/lX9ri.png
– Maniero