-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPRA_12
69 lines (52 loc) · 969 Bytes
/
PRA_12
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
/*A program to demonstrate use of static data member functions */
#include<iostream>
#include<iomanip>
using namespace std;
class sta
{
char fname[10],lname[10];
char div;
static int getObjCount;
public:
void getData(int a)
{
cout <<"USER : "<< a << endl;
cout << "Enter Your First Name : ";
cin >> fname;
cout << "Enter Your Last Name : ";
cin >> lname;
cout<<"Enter your Division: ";
cin >> div;
}
static int getCount()
{
getObjCount++;
return getObjCount;
}
void putData()
{
cout << "Enterd details : ";
cout<<setw(10)<<fname<<" "<<lname <<setw(5)<<div<<endl;
}
void totalObj(int c)
{
cout << endl<< "Total Entries : " <<c;
}
};
int sta :: getObjCount;
int main()
{
int c;
sta s1,s2,s3;
c =s1.getCount();
s1.getData(c);
c=s2.getCount();
s2.getData(c);
c=s3.getCount();
s3.getData(c);
s1.putData();
s2.putData();
s3.putData();
s3.totalObj(c);
return 0;
}