Write a program that inputs basic salary and calculates 35%dearness allowance'25% house rentand then displays the gross salary.

Would something like this work?

#include <iostream>
using namespace std;

const double DEARNESS = .35;
const double HOUSING = .25;

int main(){
    double basicSalary;

    cout << "Enter Basic Salary:";
    cin >> basicSalary;

    cout << "Basic Salary: " << basicSalary << endl
         << "Dearness Allowance: "  << basicSalary*DEARNESS << endl
         << "Housing Allowance: " << basicSalary*HOUSING << endl
         << "Gross Salary: " << (basicSalary*DEARNESS)+(basicSalary*HOUSING)+basicSalary << endl;

    system("pause");
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.