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;
}
errorebug error !
Thanks pro trước :yy73:
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;
}
errorebug error !
Thanks pro trước :yy73: