### Structures

Declare a structure Employee. An employee has a name, and employee number and salary.
Write a function that takes a employee as parameter and prints out the details of that
employee. The details of the employees are contained in the file called employees.txt in the
following format:
employee1 9007 35000
employee2 9005 45000
employee3 9003 45000.
The total number of employees is not known.
Finally write the main function that reads the data from the file and print out the details of all
employees earning more than 300000.

 ``1234567891011121314151617181920212223242526272829`` `````` #include using namespace std; double taxPayable(double salary); double tax; {if(salary <= 150000) tax = salary*0.2; else tax = 30000 + (salary - 150000)*0.25; return (tax); } int main() { double amount; cout<<"Enter the amount of your salary: " ; cin>>amount; cout<>amount; }while (amount!=0 && amount>0); return 0; } ``````

it gives me 1 error dnt knw whaats wrong!
Your definition of function `taxPayable` has several errors, including the semicolon on the first line, and misplaced opening brace.

 ``12345678`` ``````double taxPayable(double salary); double tax; {if(salary <= 150000) tax = salary*0.2; else tax = 30000 + (salary - 150000)*0.25; return (tax); }``````

replace with:
 ``1234567891011`` ``````double taxPayable(double salary) { double tax; if (salary <= 150000) tax = salary*0.2; else tax = 30000 + (salary - 150000)*0.25; return (tax); }``````

This line doesn't really need both conditions:
`while (amount!=0 && amount>0);`

This is simpler: `while (amount > 0);`
Topic archived. No new replies allowed.