help

I have a question i need help

1\write a c++ program to count no of letters in a given line

2\write a c++ program to calculate employee salary
validation : for the salary less than 5000
a. HRA IS 15% OF BASIC salary
b. DA is 35% of basic salary
for salary above 5000
a HRA is 5% of basic salary
b. DA is 25% of basic salary
You should also show your code...
first one i thank he want example

and the second with c++
I was talking about what you tried to write... This is homework, so the first attempt should come from you! ;)
will I'm not sure of my answer
so i want to see another answer
Nobody here is going to give you a grade! So please show what you did, otherwise what do we have to think? That you want your homework done? :)
second one what the mistake

#include<iostream>
using namespace std;

int main()
{
float basic_salary, gross_salary, HRA, DA;
cout<<"Enter basic salary of Employee : ";
cin>>basic_salary;

if (basic_salary<5000)
{
HRA=0.15*basic_salary;
DA=0.35*basic_salary;
}
else
{
HRA=0.5*basic_salary;
DA=0.25*basic_salary;
}

gross_salary=basic_salary+HRA+DA;
cout<<"Gross salary is : "<<gross_salary;

cin.ignore();
cin.get();
return 0;
}
5% is not .5

for salary above 5000
a HRA is 5% of basic salary
b. DA is 25% of basic salary


1
2
3
4
5
else
{
HRA=0.5*basic_salary;
DA=0.25*basic_salary;
}



Edit: I'm not sure what HRA and DA are, so I'm assuming it's correct they should be added to the basic salary?
Last edited on
Topic archived. No new replies allowed.