Please give some comments

hi programmers below is my code please check it and tell me is it perfect or not
by perfect i mean can make it more good and readable and of course efficient
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
class  trapezoid{
public:
	trapezoid();
	trapezoid(float,float,float);
	trapezoid operator +(trapezoid&);
	void getinput();
	float get_base1();
	float get_base2();
	float get_hight();
	void set_base1(float);
	void set_base2(float);
	void set_hight(float);
	void display(float);
	friend void calculateArea(trapezoid,trapezoid);
		
private:
	float  base1,base2,hight;
};
trapezoid::trapezoid()
{
	base1 = 0.0;
	base2 = 0.0;
	hight = 0;

}
trapezoid::trapezoid(float bs1,float bs2,float ht)
{
	base1 = bs1;
	base2 = bs2;
	hight = ht;


}
void trapezoid::display(float result)
{
	cout<<"base 1: "<<get_base1()<<endl;
	cout<<"base 2: "<<get_base2()<<endl;
	cout<<"hight : "<<get_hight()<<endl;
	cout<<"The Eare of the Trapezoid is: "<<result<<endl;
}
// Getter functions of the class
float trapezoid::get_base1()
{
	return base1;
}
float trapezoid::get_base2()
{
	return base2;
}
float trapezoid::get_hight()
{
	return hight;
}
// Setter functions of the class
void trapezoid::set_base1(float bs1)
{
	base1 = bs1;

}
void trapezoid::set_base2(float bs2)
{
	base2 = bs2;
}
void trapezoid::set_hight(float ht)
{
	hight = ht;
}

trapezoid trapezoid::operator+(trapezoid& trap)
{
	trapezoid temp;
	temp.base1 = base1 + trap.base1;
	temp.base2 = base2 + trap.base2;
	temp.hight = hight + trap.hight;
	return temp;

}
void trapezoid::getinput()
{
	float bs1 = 0.0;
	float bs2 = 0.0;
	float ht = 0;
	cout<<"Please Enter Base 1: ";
	cin>>bs1;
	cout<<"Please Enter Base 2: ";
	cin>>bs2;
	cout<<"Please Enter Hight: ";
	cin>>ht;
	set_base1(bs1);
	set_base2(bs2);
	set_hight(ht);
}
void calculateArea(trapezoid bs1,trapezoid bs2)
{
	float result;
	trapezoid addobj;
	addobj = bs1 + bs2;
    result = (addobj.base1+addobj.base2)/2*addobj.hight;
	addobj.display(result);

}
int main()
{
	trapezoid bs1;
	trapezoid bs2;
	cout<<"Object {1}"<<endl;
	bs1.getinput();
	cout<<endl;
	cout<<"Object {2}"<<endl;
	bs2.getinput();
	calculateArea(bs1,bs2);
	_getch();


}
You don't have return 0; at the end of main, otherwise I don't see anything other than the lack of comments.
Topic archived. No new replies allowed.