I got some errors with the code below that made it impossible to run,It seems the error is in destructor but I don't know how to fix it, please check for me, I thank
#include<iostream>
#include<string.h>
using namespace std;
class SinhVien{
private:
static int msv;
char name[256];
char address[256];
int phone;
float point1, point2, point3;
public:
SinhVien(){
}
~SinhVien();
void input(){
cout <<"Nhap ten: ";
fflush(stdin);
gets(name);
cout <<"Nhap dia chi: ";
fflush(stdin);
gets(address);
cout <<"Nhap so dien thoai: ";
cin >>phone;
cout <<"Nhap diem 3 mon: ";
cin >>point1 >> point2 >> point3;
}
void output(){
cout <<"Ma sinh vien: "<<msv<<endl;
msv++;
cout <<"Ho ten: "<<name<<endl;
cout <<"Dia chi: "<<address<<endl;
cout <<"So dien thoai: "<<phone<<endl;
cout <<"Diem 3 mon: "<<point1<<" "<<point2<<" "<<point3<<endl;
}
};
main(){
SinhVien sv;
sv.input();
sv.output();
system("pause");
}
This is an error
C:\Users\Admin\AppData\Local\Temp\ccaMkngb.o ex4.cpp:(.text+0x4e): undefined reference to `SinhVien::~SinhVien()'
C:\Users\Admin\AppData\Local\Temp\ccaMkngb.o ex4.cpp:(.text+0x64): undefined reference to `SinhVien::~SinhVien()'
C:\Users\Admin\AppData\Local\Temp\ccaMkngb.o ex4.cpp:(.rdata$.refptr._ZN8SinhVien3msvE[.refptr._ZN8SinhVien3msvE]+0x0): undefined reference to `SinhVien::msv'
C:\Users\Admin\Desktop\OOP\exclass\collect2.exe [Error] ld returned 1 exit status