Giúp về mảng có cấu trúc C++

COde mình bị lỗi mong pro vào giúp :
file Khaibao.h
Mã:
#include <iostream>
#include <string.h>
#define MAX 100
using namespace std;

typedef struct VIDEO
{
    char tenphim[MAX];
    char theloai[20];
    char namedaodien[MAX];
    char nameactor[30];
    char nameactress[30];
    int namsx;
    char hangsx[30];

};

void Nhap1phim( VIDEO &p);
void Xuat1phim( VIDEO p);
void Nhapdsvideo( VIDEO a[MAX], int &n);
void Xuatdsvideo( VIDEO a[MAX], int n);
void Search_type( char s1[MAX]);

file caidat.cpp
Mã:
#include "Khaibao.h"

void Nhap1phim( VIDEO &p)
{
    cout<<" \nName film: :";
    cin.ignore();
    cin.getline(p.tenphim,30);
    cout<<" \nThe type of film: ";
    cin.getline(p.theloai, 30);
    cout<<" \nName of director: ";
    cin.getline(p.namedaodien,30);
    cout<<" \nName of actor: ";
    cin.getline(p.nameactor, 30);
    cout<<" \nName of actress: ";
    cin.getline(p.nameactress, 30);
    cout<<"\nProduction year :";
    cin>>p.namsx;
    cout<<"\nThe production:";
    cin.ignore();
    cin.getline(p.hangsx,30);
    
    
}
void Xuat1phim( VIDEO p)
{
    
    cout<<"\n"<<p.tenphim<<"\t\t"<<p.theloai<<"\t"<<p.namedaodien<<"\t"<<p.nameactor<<"\t"<<p.nameactress<<"\t\t"<<p.namsx<<"\t"<<p.hangsx;
    
}

void Nhapdsvideo( VIDEO a[MAX], int &n)
{
    do{
        cout<<"\nThe number of film wants to enter: ";
        cin>>n;
        if(n<=0)
            cout<<"Sorry! Number of invalid clicks original film. Please re-enter !";
    }while( n <=0);

    for( int i=0; i<n; i++)
    {
        Nhap1phim(a[i]);
        cout<<endl;
    }
}
void Xuatdsvideo( VIDEO a[MAX], int n)
{
    for(int i=0; i<n; i++)
    {
        Xuat1phim(a[i]);
        cout<<endl;
    }
}

void Search_type( char s1[MAX])
{
    VIDEO s;
    cout<<"\nEnter type of film which you want to find:";
    cin.getline(s1,30);

    if (strcmp(s1,s.theloai)==0)
    {
        cout<<"\nFilms which you want:\n ";
        Xuat1phim(s);
    }
    else
    {
        cout<<"Not Found !";
    }
}

hàm main()
Mã:
#include "Khaibao.h"

void main()
{
    int n;
    VIDEO vd, a[MAX];
    char s1[MAX];
    Nhapdsvideo(a,n);
    cout<<"\nName film"<<"\t"<<"Type"<<"\t"<<"Name director"<<"\t"<<"Actor"<<"\t"<<"actress"<<"\t\t"<<"production year"<<"\t"<<"porduction";
    Xuatdsvideo(a,n);
    Search_type(s1);    
    cout<<endl;
}

error:Debug error !

Thanks pro trước :yy73:
 
Sửa lần cuối:

aloxinh_nb

It's Secret !
Reply: Giup về mảng có cấu trúc C++

Mọi người giúp em với :|
 
Sửa lần cuối:

aloxinh_nb

It's Secret !
#include "Khaibao.h"

void main()
{
int n;
VIDEO vd, a[MAX];
char s1[MAX];
Nhapdsvideo(a,n);
cout<<"\nName film"<<"\t"<<"Type"<<"\t"<<"Name director"<<"\t"<<"Actor"<<"\t"<<"actress"<<"\t\t"<<"production year"<<"\t"<<"porduction";
Xuatdsvideo(a,n);
Search_type(s1,vd);
cout<<endl;
}
void mian mới nhất đây
 

aloxinh_nb

It's Secret !
Reply: Giup về mảng có cấu trúc C++

void Search_type( char s1[MAX],VIDEO a[MAX], int n)
{

cout<<"\nEnter type of film which you want to find:";
cin.getline(s1,30);

for( int i=0; i<n; i++)
{
if (strcmp(s1,a.theloai)==0)
{
cout<<"\nFilms which you want:\n ";
Xuat1phim(a);
}
else
{
cout<<"Not Found !";
}
}
}
 

Lê Minh

✩✩✩✩
Reply: Giup về mảng có cấu trúc C++

Bạn thử sửa 2 hàm này xem nhe

Mã:
void Search_type( char s1[MAX], VIDEO s)
{
    cout<<"\nEnter type of film which you want to find:";
    cin.getline(s1,30);

    if (strcmp(s1,s.theloai)==0)
    {
        cout<<"\nFilms which you want:\n ";
        Xuat1phim(s);
    }
    else
    {
        cout<<"Not Found !";
    }

Mã:
void main()
{
    int n;
    VIDEO vd, a[MAX];
    char s1;
    Nhapdsvideo(a,n);
    cout<<"\nName film"<<"\t"<<"Type"<<"\t"<<"Name director"<<"\t"<<"Actor"<<"\t"<<"actress"<<"\t\t"<<"production year"<<"\t"<<"porduction";
    Xuatdsvideo(a,n);

cout<< "Nhap the loai ban muon tim kiem:";
cin>> s1;

for( int i=0; i<n; i++){
Search_type(s1, a[i]);    
}
    
    cout<<endl;
}
 

aloxinh_nb

It's Secret !
Reply: Giup về mảng có cấu trúc C++

void Search_type(VIDEO a[MAX], int n)
{
char s1[MAX];
cout<<"\nEnter type of film which you want to find:";
cin.getline(s1,30);

for( int i=0; i<n; i++)
{
if (strcmp(s1,a.theloai)==0)
{
cout<<"\nFilms which you want:\n ";
Xuat1phim(a);
}
else
{
cout<<"Not Found !";
}
}
}


#include "Khaibao.h"

void main()
{
int n;
VIDEO vd, a[MAX];
char s1[MAX];
Nhapdsvideo(a,n);
cout<<"\nName film"<<"\t"<<"Type"<<"\t"<<"Name director"<<"\t"<<"Actor"<<"\t"<<"actress"<<"\t\t"<<"production year"<<"\t"<<"porduction";
Xuatdsvideo(a,n);


Search_type(a,n);
cout<<endl;
}
 
Top