-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment1.cpp
63 lines (62 loc) · 1.29 KB
/
Assignment1.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*Assignment no: 01
Problem Statements: WRITE A CPP PROGRAM TO DISPLAY NAMES,EMPLOYEE_ID,SALARY OF
THREE EMPLOYEES DECLEAR THE CLASS OF EMPLOY CREATE A ARRAY OF
CLASS OBJECTS READ AND DISPLAY THE CONTENT OF ARRAY
Name:Shete Siddarth Sudhir
Class : FYC Roll no:61
*/
#include<iostream>
#include<string.h>
using namespace std;
class employee{
public:
string name;
int id;
int salary;
};
int main()
{
employee e[100];
int a,i;
cout<<"Enter the number of Employees : "<<endl;
cin>>a;
for(i=0;i<a;i++)
{
cout<<"Name of Employee "<<i+1<<endl;
cin>>e[i].name;
cout<<"ID of Employee "<<i+1<<endl;
cin>>e[i].id;
cout<<"Salary of Employee "<<i+1<<endl;
cin>>e[i].salary;
}
for(i=0;i<a;i++)
{
cout<<"Name of Employee "<<i+1<<" : "<<e[i].name<<endl;
cout<<"ID of Employee "<<i+1<<" : "<<e[i].id<<endl;
cout<<"Salary of Employee "<<i+1<<" : "<<e[i].salary<<endl;
}
return 0;
}
/*
Output:
Enter the number of Employees :
2
Name of Employee 1
Rajesh
ID of Employee 1
123456
Salary of Employee 1
30000
Name of Employee 2
Suresh
ID of Employee 2
543216
Salary of Employee 2
45000
Name of Employee 1 : Rajesh
ID of Employee 1 : 123456
Salary of Employee 1 : 30000
Name of Employee 2 : Suresh
ID of Employee 2 : 543216
Salary of Employee 2 : 45000
*/