0
#define MAX 15
#define TAM 2
struct
{
char m[MAX];
int ano;
float v;
} car[TAM];
int main(void)
{
int i;
int p;
for(i=0; i<TAM; i++)
{
printf("Determine a Marca e Modelo do Carro %d: ", i+1);
gets(car[i].m);
printf("Determine o Ano do Carro %d: ", i+1);
scanf("%d", &car[i].ano);
printf("Determine o Valor do Carro1 %d: ", i+1);
scanf("%f", &car[i].v);
fflush(stdin);
}
printf("Determine o seu Orcamento: ");
scanf("%f", &p);
for(i<0; i<TAM; i++)
{
if(car[i].v<p)
{
printf("Marca: %s\nAno: %d\nPreco: %.2f", car[i].m, car[i].ano, car[i].v);
}
}
return 0;
}
in the second
for
the beginning is wrong and should bei = 0
and noti < 0
. That’s a typo right there.– Isac