forked from sat5297/hacktober-coding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemployee.cpp
37 lines (37 loc) · 791 Bytes
/
employee.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
#include<iostream>
#include<cstring>
struct Employee{
char name[50];
int id;
int dob;
float bsal;
};
int main(){
int n=0,p=0;
float hig=0.0;
std::cout<<"enter no. of employees\n";
std::cin>>n;
struct Employee emp[n];
std::cout<<"enter details of employees\n";
for(int i=0;i<n;i++){
std::cout<<"for employee no. "<<(i+1)<<"\n";
std::cout<<"enter name\n";
std::cin>>emp[i].name;
std::cout<<"enter ID\n";
std::cin>>emp[i].id;
std::cout<<"date of birth,in [ddmmyy] format\n";
std::cin>>emp[i].dob;
std::cout<<"enter salary\n";
std::cin>>emp[i].bsal;
}
for(int i=0;i<n;i++){
if(emp[0].bsal<emp[i].bsal){
hig=emp[i].bsal;
p=i;
}
}
std::cout<<"employee with the highest salary is "<<emp[p].name<<"\n";
std::cout<<"salary: Rs. "<<emp[p].bsal<<"\n";
std::cout<<"DOB= "<<emp[p].dob<<"\n";
return 0;
}