Em chỉ cout bình thường thôi , em cũng không biết sao sai ạ. Mong mn giúp đỡ , em cảm ơn
[Error] no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream}’ and ‘DiemThi’)
#include <iostream>
#include <string.h>
#include <fstream>
const int MAXLOP = 500 ;
const int MAXCAUHOI=2000 ;
const int MAXDATHI=100 ;
using namespace std ;
//==================CAU HOI DA THI=============================
struct CauHoiDaThi{
int id ;
int DAchon;
//----------Phuong thuc-----------
void Read_CHDT(ifstream &file) ;
void Write_CHDT(ofstream &file) ;
};
struct DanhSachCHDT{
int sldt = 0 ;
CauHoiDaThi *NodesCHDT[MAXDATHI] ;
//---------Phuong thuc-------------
//void Nhap_CHDT(int );
int Delete_DS_CHDT();
void Insert_CHDT(int limit , int arr[], int ans[] ) ;
void Read_DS_CHDT(ifstream &file) ;
void Write_DS_CHDT(ofstream &file) ;
};
//
struct DiemThi{
string MaMonHoc ;
float Diem ;
DanhSachCHDT CHDT ;
//======================PHUONG THUC=====================
void Xuat_DT(int x , int y ) ;
void Read_DT(ifstream &file);
void Write_DT(ofstream &file);
};
struct NodeDiemThi{
DiemThi DT;
NodeDiemThi *DTnext;
};
struct DanhSachDiemThi{
int SlDT=0 ;
NodeDiemThi *First = NULL ;
NodeDiemThi *Last = NULL ;
//===================PHUONG THUC====================
void InsertLast_DT(DiemThi a);
void Insert_DT(string id , float diem , int arr[], int limit) ;
void Xuat_DT(int x, int y , string mamonhoc) ;
DiemThi *Search_DT(string mamonhoc) ;
void Delete_DS_DT();
void Read_DS_DT(ifstream &file);
void Write_DS_DT(ofstream &file);
};
int main(){
DanhSachCHDT listCHDT ;
int arr[MAXCAUHOI];
int ans[MAXCAUHOI];
DanhSachDiemThi listDT ;
DiemThi a ;
a.Diem = 5;
listDT.InsertLast_DT(a) ;
cout<<"Danh sach diem thi\n";
NodeDiemThi *p = listDT.First ;
while(p!=NULL){
cout << p->DT << endl ; // Máy báo lỗi chổ này ạ
p=p->DTnext ;
}
}
void CauHoiDaThi::Read_CHDT(ifstream &file){
file >> id ;
file >> DAchon;
}
void CauHoiDaThi::Write_CHDT(ofstream &file){
file << id <<" "<<DAchon<<'\n';
}
//=============PHUONG THUC DS CHDT===============
int DanhSachCHDT::Delete_DS_CHDT(){
for(int i=0 ; i<sldt ; i++){
delete NodesCHDT[i] ;
}
sldt=0;
}
void DanhSachCHDT::Insert_CHDT(int limit , int arr[], int ans[] ){
sldt=limit ;
cout<<sldt ;
for(int i=0 ; i<limit ; i++){
NodesCHDT[i] = new CauHoiDaThi ;
NodesCHDT[i]->id = arr[i] ;
NodesCHDT[i]->DAchon=ans[i];
}
}
void DanhSachCHDT::Read_DS_CHDT(ifstream &file){
file >> sldt ;
for(int i=0 ; i<sldt ; i++){
NodesCHDT[i] = new CauHoiDaThi ;
NodesCHDT[i]->Read_CHDT(file) ;
}
}
void DanhSachCHDT::Write_DS_CHDT(ofstream &file){
file << sldt <<endl ;
for(int i=0 ; i<sldt ; i++){
NodesCHDT[i]->Write_CHDT(file) ;
}
}
//=============PHUONG THUC DANH SACH DIEM THI===
void DanhSachDiemThi::InsertLast_DT(DiemThi a){
NodeDiemThi *pNode = new NodeDiemThi ;
pNode->DT=a ;
pNode->DTnext=NULL;
if(First==Last==NULL){
First=Last=pNode ;
}
else{
Last->DTnext=pNode ;
Last=pNode ;
}
SlDT++;
}