-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPRA_13
44 lines (42 loc) · 814 Bytes
/
PRA_13
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
/* A program to demonstrate use of array of objects */
#include<iostream>
#include<iomanip>
using namespace std;
class arobj // defining class array of object
{
char fname[10],lname[10];
char div;
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;
}
void putData(int b)
{
cout<<b<<setw(15)<<fname<<" "<<lname <<setw(5)<<div<<endl;
}
};
int main()
{
int c;
cout <<"Enter no. of Entries :";
cin >> c;
arobj s[c];
for(int i=0;i<c;i++)
{
s[i].getData(i);
}
cout << "Enterd details : "<<endl;
cout<<setw(15)<<"fname"<<" lname "<<setw(5)<<"div"<<endl;
for(int i=0;i<c;i++)
{
s[i].putData(i);
}
return 0;
}