Tax deduction function

I'm trying to write a function for whether or not tax deductions are applied based on income and family size but I keep getting errors in my build. If income is less than or equal to $30,000 with a household size of 4 or more, then no income tax is applied. Otherwise 25% deduction is applied.

Here is what I have.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  #include <iostream>
using namespace std;

int main()
{
	
	int income;
	double size, tax_deduction;
	
	cout << "Please enter your household income: $";
	cin>> income;
	cout<< "Please enter your household size: ";
	cin>>size;

	if (income <= 30,000, size > 4)
		tax_deduction: income*0;
	else 
		tax_deduction: income*.25;

	cout<< "Income: $" << income;
	cout<< "Family size: " << size;
	cout<< "Tax deduction: " << tax_deduction;





  getchar();
  getchar();

	return 0;
}


Any help would be appreciated.
Here's your problem.
If you want to check multiple conditions in an if statement, you need to use &&, not a comma, and numbers (no matter how big) can't have commas in them.
Try this:
if ((income <= 30000) && (size > 4))

Don't put commas in numbers. The compiler won't interpret that as a number.

Hope that helps!
Change (income <= 30,000, size > 4) to (income <= 30000&&size > 4)
closed account (48T7M4Gy)
Isn't ':' meant to be '=' ?

why multiply income by zero when you could simply say that the tax deduction is zero? It would be certainly easier to read and check if you did.
Thank you for all the replies! I'm still learning to use C++ so please bear with me.

Topic archived. No new replies allowed.