Các pro xem dùm mình hàm XuatSV và hàm TotNghiep có gì sai nha
Đây là đề :

Viết chương trình quản lý sinh viên tại một trường đại học. Thông tin một
sinh viên gồm MSSV, họ tên. Sinh viên sẽ theo học các môn nhất định. Mỗi
môn học có mã và tên phân biệt. Mỗi môn học tương ứng với một số lượng
tín chỉ nhất định. Điểm mỗi môn học được tính theo thang 10. Sinh viên đạt
một môn học nếu điểm môn đó lớn hơn bằng 5 điểm. Để được tốt nghiệp,
sinh viên phải thỏa những điều kiện sau: phải có tổng số tín chỉ đậu là 10 trở
lên, điểm trung bình các môn từ 5 trở lên.
Yêu cầu chương trình:
Câu 1: Xuất ra màn hình thông tin sinh viên có đậu tốt nghiệp
- MSSV
- Họ tên
- Danh sách môn học: mã môn, tên môn, số tín chỉ, điểm
- Điểm trung bình
//DiemTB=(mon1*soTinChi1+mon2*soTinChi2+…)/(soTinChi1+
soTinChi2+…)
SINHVIEN.h


#pragma once
#include<iostream>
using namespace std;

class MONHOC
{
private:
char mamon[30],tenmon[30];
int tinchi;
float diem;
public:
int GetTinChi();
float GetDiem();
void NhapMon();
void XuatMon();
};

class SINHVIEN
{
private:
int mssv;
char hoten[30];
int slm;
float dtb;
MONHOC *p;
int slsv;
SINHVIEN *sv;
public:
int TotNghiep();
void NhapSV();
void XuatSV();
float DTB();
int GetSoLuongMon();
};
SINHVIEN.cpp


#include "SINHVIEN.h"

float MONHOC::GetDiem()
{
return diem;
}
int MONHOC::GetTinChi()
{
return tinchi;
}
int SINHVIEN::GetSoLuongMon()
{
return slm;
}

void MONHOC::NhapMon()
{
SINHVIEN sv;
cout<<"Nhap so luong mon : ";
int somon=sv.GetSoLuongMon();
cin>>somon;
for(int i=1;i<=somon;i++)
{
flushall();
cout<<"Nhap ma mon : ";
cin>>mamon;
cout<<"Nhap ten mon : ";
cin>>tenmon;
cout<<"Nhap so tin chi : ";
cin>>tinchi;
cout<<"Nhap diem : ";
cin>>diem;
}
}

float SINHVIEN:: DTB()
{
p=new MONHOC[slm+1];
float tongdiem=0;
int tongtinchi=0;
for(int i=1;i<=slm;i++)
{
tongdiem=tongdiem + p[i].GetDiem()*p[i].GetTinChi();
tongtinchi=tongtinchi + p[i].GetTinChi();
dtb=tongdiem/tongtinchi;
}
return dtb;
}

void MONHOC::XuatMon()
{
SINHVIEN sv;
float DTB=sv.DTB();
cout<<"Thong tin danh sach mon hoc : ";
cout<<" Ma mon : "<<mamon<<". Ten Mon : "<<tenmon<<". So tin chi : "<<tinchi<<". Diem : "<<diem<<endl;
cout<<" Diem TB la : "<<DTB<<endl;
}

void SINHVIEN::NhapSV()
{
MONHOC m;
cout<<"Nhap so luong sinh vien : ";
cin>>slsv;
sv=new SINHVIEN[slsv+1];
for(int i=1;i<=slsv;i++)
{
cout<<"Nhap MSSV : ";
cin>>mssv;
cout<<"Nhap ten sinh vien : ";
cin>>hoten;
m.NhapMon();
}
}

int SINHVIEN::TotNghiep()
{
int tinchidau=0;float diem;
for(int i=1;i<=slm;i++)
{
diem=p[i].GetDiem();
if(diem>=5)
{
tinchidau=tinchidau + p[i].GetTinChi();
}
}
if(tinchidau>=10 && dtb>=5)
return 1;
else
return 0;
}

void SINHVIEN::XuatSV()
{
int kt=0;int dem=0;
for(int i=1;i<=slsv;i++)
{

kt=sv[i].TotNghiep();
if(kt==1)
{
dem++;

}
}
for(int i=1;i<=slsv;i++)
{
if(dem>0)
{
MONHOC m;
cout<<" Danh sach sinh vien dau tot nghiep : ";
cout<<" MSSV : "<<mssv<<". Ho ten : "<<hoten<<endl;
m.XuatMon();
}
else
cout<<"Khong co sinh vien nao tot nghiep ";
}

}
main.cpp


#include"SINHVIEN.h"

void main()
{
SINHVIEN sv;
sv.NhapSV();
sv.XuatSV();
}