User: 12520884
Infraction: Tạo thread thiếu chất lượng
Points: 1
Administrative Note:
Originally posted by sinhvien.uit
View Post
Message to User:
Originally posted by sinhvien.uit
View Post
Original Post:
Class point
point.cpp
class tamgiac
tamgiac.cpp
debug nó báo lỗi @@ các bác fix giùm mình với!
Code:
#pragma once #include "tamgiac.h" class point { public: friend class tamgiac; private: float fytungdo; float fxhoanhdo; public: float laytungdo(); float layhoanhdo(); void dattungdo(float ftungdo); void dathoanhdo(float fhoanhdo); int nhapdiem(); int xuatdiem(); };
Code:
#include "point.h" #include <iostream> using namespace std; float point::laytungdo() { return fytungdo; } float point::layhoanhdo() { return fxhoanhdo; } void point::dattungdo(float ftungdo) { fytungdo = ftungdo; } void point::dathoanhdo(float fhoanhdo) { fxhoanhdo = fhoanhdo; } int point::nhapdiem() { cout << "Nhap Tung Do:"; cin >> this->fytungdo; cout << "Nhap Hoanh Do:"; cin >> this->fxhoanhdo; return 1; } int point::xuatdiem() { cout << "(" << this->fytungdo << "," << this->fxhoanhdo << ")"; return 1; }
Code:
#pragma once #include "point.h" class tamgiac :public point { private: point A, B, C; public: void nhap(); void kiemtra(); void xuat(); };
Code:
#include "tamgiac.h" #include "point.h" #include <iostream> #include <conio.h> using namespace std; void tamgiac::nhap() { cout << "Nhap toa doa cua diem a"; A.nhapdiem(); A.xuatdiem(); cout << "Nhap toa do cua diem b"; B.nhapdiem(); B.xuatdiem(); cout << "Nhap toa do cua diem c"; C.nhapdiem(); C.xuatdiem(); } void main() { tamgiac tg; tg.nhap(); _getch(); }