-
Notifications
You must be signed in to change notification settings - Fork 0
/
SinhVien.h
63 lines (59 loc) · 1.87 KB
/
SinhVien.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// Created by vincent on 4/26/22.
//
#ifndef TEST_SINHVIEN_H
#define TEST_SINHVIEN_H
#include "nguoi.h"
#include <string>
#include <iostream>
using namespace std;
class SinhVien : public Nguoi{
protected:
string maSinhVien;
string nganhHoc;
public:
SinhVien(){
this->socmnd = "";
this->hoTen = "";
this->queQuan = "";
this->namSinh = 0;
this->maSinhVien = "";
this->nganhHoc = "";
}
SinhVien(string _socmnd, string _hoTen, string _queQuan, int _ngaySinh, string _maSinhVien, string _nganhHoc){
this->socmnd = _socmnd;
this->hoTen = _hoTen;
this->queQuan = _queQuan;
this->namSinh = _ngaySinh;
this->maSinhVien = _maSinhVien;
this->nganhHoc = _nganhHoc;
}
~SinhVien(){
this->socmnd = "";
this->hoTen = "";
this->queQuan = "";
this->namSinh = 0;
this->maSinhVien = "";
this->nganhHoc = "";
}
// Input
friend istream& operator >> (istream& is, SinhVien &obj){
cin.ignore();
cout << "\n Nhap CMND: "; fflush(stdin); getline(is, obj.socmnd);
cout << "\n Nhap ho ten: "; fflush(stdin); getline(is, obj.hoTen);
cout <<"\n Nhap que quan: "; fflush(stdin); getline(is, obj.queQuan);
cout <<"\n Nhap ma sinh vien: "; fflush(stdin); getline(is, obj.maSinhVien);
cout <<"\n Nhap nganh hoc: "; fflush(stdin); getline(is, obj.nganhHoc);
cout <<"\n Nhap nam sinh: "; is >> obj.namSinh;
}
//Output
friend ostream& operator << (ostream& os, SinhVien &obj){
cout << "\n CMND: "<< obj.socmnd;
cout << "\n Ho ten: "<< obj.hoTen;
cout << "\n Que quan: "<<obj.queQuan;
cout << "\n Nam sinh: "<< obj.namSinh;
cout << "\n Ma sinh vien: "<<obj.maSinhVien;
cout << "\n Nganh hoc: "<<obj.nganhHoc;
}
};
#endif //TEST_SINHVIEN_H