-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlec25.cpp
44 lines (40 loc) · 806 Bytes
/
lec25.cpp
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
#include <iostream>
using namespace std;
//array of objects and passing objects as function arguments
class Employee
{
int id;
int sellary;
public:
void setid(void)
{
sellary = 11500;
cout << "Enter employee ID: " << endl;
cin >> id;
}
void getid(void)
{
cout << "ID is: " << id << endl;
cout << "Sellary is: " << sellary << endl;
}
};
int main()
{
// Employee hamid;
// hamid.setid();
// hamid.getid();
Employee company[3];
/*company[0].setid();
company[0].getid();
company[1].setid();
company[1].getid();
company[2].setid();
company[2].getid();*/
for (int i = 0; i < 3; i++)
{
/* code*/
company[i].setid();
company[i].getid();
}
return 0;
}