Write a program to calculate the net salary of an employee using the concept of structure.
#include <iostream>
#include <iomanip>
using namespace std;
struct employee
{
char name[20];
float bp;
float da;
float hra;
float netpay;
}emp;
employee calculatePay(employee empl)
{
empl.netpay =empl.bp + empl.da +empl.hra;
return empl;
}
void main()
{
employee npay(employee emp);
employee y;
cout<<"Enter the Name, Basic Pay, Da, Hra: ";
cin>>emp.name>>emp.bp>>emp.da>>emp.hra;
y= calculatePay(emp);
cout<<"\nNet pay is : "<<y.netpay<<"\n\n";
system("pause");
}
Comments
Leave a comment