Answer to Question #298727 in C++ for Wasim Akram

Question #298727

Write a program to calculate the net salary of an employee using the concept of structure.


1
Expert's answer
2022-02-16T16:32:41-0500


#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");
} 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog