hi, i got this error error no match 'for operator[]'


hi, i´m doing a program for a cinema, so i´m trying to compile this but it returns me several errors-->"in function bool compare(TipoPelcula&, Char*)'
and this one too "error no match 'for operator[]' in pelicula[x]


include <stdio.h>
#include <string.h>


const int caracteres=100;
const int limitePelis=30;

typedef char TipoTitulo[caracteres];

typedef struct TipoPelicula {
TipoTitulo titulo;
int entradas;
TipoFecha fecha;
TipoHora horario;
TipoGenero genero;
};
TipoPelicula pelicula;
TipoPelicula texto;
int i=0;

/*this function compares all the film title arrays*/
bool compare(TipoPelicula pelicula,TipoTitulo texto){
int aux=0;
for (int x=0;x<=limitePelis;x++){
if (strcmp(pelicula[x].titulo,texto)==0) {
aux++;

}
}
if(aux>0){
return true;}
else{
return false;}
}

void AltaTitulo(TipoPelicula pelicula) {
TipoTitulo texto;
int aux=0;
do {
printf("titulo de la pelicula : ");
scanf(" %[^\n]s",&texto);

if (!(compare(pelicula,texto))){

strcpy(pelicula[i].titulo,texto);
aux++;
}
}while(aux<=0);
}
int main() {

AltaTitulo(pelicula);
printf("pelicula",pelicula.titulo[i]);
}
It seems you keep using pelicula as if it were an array of TipoPelicula, when it is actually only an instance.
ufff i don´t know the correct way to do it... c++ is making me mad
Topic archived. No new replies allowed.