So i've been through a problem , i have to make a cab programm for school , so , i hava an case in which i need to give user an option to change the car avaliablity , but for that the user's need to give the license plate in order to proceed. As i add two vehicles to struct , on case 3 , the program is only accepting license plate 1 as correct...
void alterarDisponiblidadeTaxi (TAXIS taxis[], int qtd_taxis ){
int i=0;
char matr[10];
if(0>=qtd_taxis){
printf("No data has given yet!\a\n");
return; }
printf("Insert the vehicle's plate:\n");
scanf("%s",matr);
if (strcmp(matr,taxis[i].matricula) == 0){
printf("License plate found with sucess!\n");
return 0;
}
if (strcmp(matr,taxis[i].matricula) != 0){
printf("License plate not found with sucess!\a\n");
return 0;
}
}
I think you forgot to add a
for
loop. Asi=0
, it will only check for the first Licence plate.