# Write a Program to Calculate Total Salary of an Employee in C++

write a program to calculate the total salary of a person. the user has to enter the basic salary (an integer ) and the grade (an uppercase character), and depending upon which the total salary is calculated as - Total Salary = Basic + HRA + DA + Allow – PF. Write a C++ Program To Find The Gross Salary Of An Employee. Write a c++ program to prompt the user to enter the scale and then print the employee’s basic pay, house rent allowance and total pay by using a function.

Gross salary is different from Net, Salary gross salary calculated annual basis we can calculate a gross salary by using the following formula (Gross salary = Net Salary - Deduction. ). Deduction = Tax ( HRA. + DA. + MA. ).

Gross Salary Formula in C++

Gross Salary = Basic Salary + HRA + Other Allowances

Deduction = Gross Salary - PF - PT - IT.

Net Salary = Gross Salary - Deduction.

See Also C Program For Find The Gross Salary of An Employee

To find a gross salary of an Employee we need to calculate DA and HRA then the Sum Of Basic Salary + HRA + DA. after calculating the sum print the sum. So basically first we calculate a DA, and HRA after that we add basic salary + HRA +DA so, in this way, we can find the Gross salary of an employee.

## Program to Calculate the Total Salary of an Employee in C++

``````#include <iostream>
using namespace std;
int main()
{
/* c++ program to calculate gross salary of an employee */

float GrossPayment, basic, da, hra, da1, hra1;

cout << " Enter basic salary : ";
cin >> basic;

cout << " Enter DA : ";
cin >> da1;

cout << " Enter HRA : ";
cin >> hra1;

da = (da1 *basic) / 100;
hra = (hra1 *basic) / 100;

GrossPayment = basic + da + hra;

cout << "\n Gross Salary :" << GrossPayment << endl;;
return (0);

}``````

See Also Program to Calculate Gross Salary of an Employee in Java

### Similar

Previous Post
Next Post

#### post written by: Ghanendra Yadav

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.