0
The program makes car rentals, it takes license plate and the type of car, both stored in two different matrices, as I do to get only the license plates of the luxury type cars. Code I’ve made so far
#include <string.h>
#include <stdio.h>
int main()
{
char luxo[100]="luxo";
char type[100][100];
char typeCar[100][100];
char board[100][100];
char boardOpc[100][100];
char aux[100];
int quantity = 0, i = 0, j = 0, count = 0; //quantidade de locaçoes
int compar = 0, comparType = 0;
int client[100];
int payment[100];
int countA = 0, countB = 0, countC = 0, sair = 1;
while(sair==1){
printf("Digite o tipo do veículo preferencialmente sem acento e letra minúscula: ");
scanf("%s", type[countA]);
printf("Digite a placa do veículo: ");
scanf("%s", board[countA]);
printf("Para continuar cadastrando mais uma locação digite 1, para ver as outras opções digite 0\n");
scanf("%d", &sair);
countA++;
}
sair = 1;
for(i;i<countA;i++) {
for(j=i+1;j<countA;j++) {
if(compar=strcmp(board[i], board[j]) > 0) {
strcpy(aux,board[i]);
strcpy(board[i],board[j]);
strcpy(board[j],aux);
}
}
}
count = 1;
for(i=0;i<countA;i++){
if(compar=strcmp(board[i],board[i+1]) == 0){
if(compar=strcmp(type[i], luxo)==0) {
printf("AQ");
count++;
}
}
else {
for(i=0;i<countA;i++) {
for(j=i+1;j<countA; j++) {
if(compar = strcmp(board[i], board[j])>0) {
strcpy(aux,board[i]);
strcpy(board[i],board[j]);
strcpy(board[j],aux);
}
}
}
for(i=0; i<countA; i++){
/*if(compar = strcmp(board[i], board[i+1])==0) {
if(comparType=strcmp(type[i], "luxo")==0) {
count++;
}
} else*/ if(compar = strcmp(type[i], luxo)==0) {
printf("Entrou AW");
printf("A placa %s aparece %d vezes\n", board[i], count);
count=1;
}
}
if(compar=strcmp(type[i], luxo)==0){
printf("Entrou AQUI");
printf("A placa %s aparece %d vezes\n", board[i], count);
}
}
}
}
Blz thanks I’ll take a look
– Felipe.dev