-1
I am trying to do an exercise in C that does not generate any syntax error,I have searched and can not find the error,it simply reads or returns the wrong values.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int codigo,quantidade;
float precototal;
char especificacao[] = "";
printf("Escreva o codigo do produto:");
scanf("%d",&codigo);
printf("Escreva a quantidade do produto:");
scanf("%d",&quantidade);
switch(codigo)
{
case 100:
strcpy(especificacao, "Cachorro Quente");
printf("%d",quantidade);
precototal = 1.20 * quantidade;
printf("Produto:%s,Quantidade:%d,preco unitario:%f,preco total:%f",especificacao,quantidade,1.20,precototal);
break;
case 101:
break;
case 102:
break;
case 103:
break;
}
return 0;
}
Is there any way to improve your question? Can’t know what you want.
– Francisco
When entering the code and quantity of the product, wrong values are returned, as shown in the image, the total price and quantity go wrong.
– saidmrn
What were the input data? Could put the output in writing?
– Francisco
were 100 and 1, but has already been resolved according to the answer below,!!
– saidmrn