the following code can be run properly in compiler but there are some minor error which i cant identify out. it can only input the first automobile detail but when comes to the second record it jump to the second input statement instead the first one.please point out where are the correction and thank you for everything.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct auto_t
{
char make[20];
char model[20];
int oRead;
int manufDate;
int purchDate;
float cpct;
float f_level;
};
int main(int argc, char** argv)
{
struct auto_t automobile[2];
int i;
for(i=0; i<2; i++)
{
printf("component:");
gets(automobile[i].make);
printf("model:");
gets(automobile[i].model);
printf("Odoer reading:");
scanf_s("%d", &automobile[i].oRead);
printf("manufacturing date(ddmmyyyy):");
scanf_s("%d", &automobile[i].manufDate);
printf("purchasing date(ddmmyyyy):");
scanf_s("%d", &automobile[i].purchDate);
printf("capacity:");
scanf_s("%f", &automobile[i].cpct);
printf("fuel level:");
scanf_s("%f", &automobile[i].f_level);
printf("\n");
}
printf("\nName\tModel\tOReaad\tManufDate\tPurchDate\tCpct\tFuel\n");
for(i=0; i<2; i++)
{
printf("%s\t%s\t%d\t%d\t%d\t%.f\t%.f\n", automobile[i].make, automobile[i].model, automobile[i].oRead, automobile[i].manufDate, automobile[i].purchDate, automobile[i].cpct, automobile[i].f_level);
}
system("pause");
}