Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- using namespace std;
- class TinhCach {
- protected:
- char Loai;
- int ChiSo;
- public:
- virtual void XuatKetQua() = 0;
- void Nhap() {
- cout << "Nhap chi so yeu to " << Loai << ": ";
- cin >> ChiSo;
- }
- int GetChiSo() {
- return ChiSo;
- }
- char GetLoai() {
- return Loai;
- }
- };
- class TraiNghiem : public TinhCach {
- public:
- TraiNghiem() {
- Loai = 'O';
- }
- void XuatKetQua() {
- if (ChiSo >= 70) {
- cout << "Nguoi co diem cao o yeu to O ...";
- }
- else if (ChiSo <= 30) {
- cout << "Nguoi co diem thap o yeu to O ...";
- }
- else cout << "Khong xac dinh ro";
- cout << endl;
- }
- };
- class TuChu : public TinhCach {
- public:
- TuChu() {
- Loai = 'C';
- }
- void XuatKetQua() {
- if (ChiSo >= 70) {
- cout << "Nguoi co diem cao o yeu to C ...";
- }
- else if (ChiSo <= 30) {
- cout << "Nguoi co diem thap o yeu to C ...";
- }
- else cout << "Khong xac dinh ro";
- cout << endl;
- }
- };
- class HuongNgoai : public TinhCach {
- public:
- HuongNgoai() {
- Loai = 'E';
- }
- void XuatKetQua() {
- if (ChiSo >= 70) {
- cout << "Nguoi co diem cao o yeu to E ...";
- }
- else if (ChiSo <= 30) {
- cout << "Nguoi co diem thap o yeu to E ...";
- }
- else cout << "Khong xac dinh ro";
- cout << endl;
- }
- };
- class HoaDong : public TinhCach {
- public:
- HoaDong() {
- Loai = 'A';
- }
- void XuatKetQua() {
- if (ChiSo >= 70) {
- cout << "Nguoi co diem cao o yeu to A ...";
- }
- else if (ChiSo <= 30) {
- cout << "Nguoi co diem thap o yeu to A ...";
- }
- else cout << "Khong xac dinh ro";
- cout << endl;
- }
- };
- class BatOn : public TinhCach {
- public:
- BatOn() {
- Loai = 'N';
- }
- void XuatKetQua() {
- if (ChiSo >= 70) {
- cout << "Nguoi co diem cao o yeu to N ...";
- }
- else if (ChiSo <= 30) {
- cout << "Nguoi co diem thap o yeu to N ...";
- }
- else cout << "Khong xac dinh ro";
- cout << endl;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement