Help with If Statements

#include <iostream>
using namespace std;


int computeTax (float income,int percent);

int main()
{
float income;
int percent;
// prompt the user
cout << "Income: ";
cin >> income;
cout << "Your tax bracket is " << percent << "%" << endl;
return 0;
}

int computeTax(float income,int percent)
{
{
if (income <= 15100)
percent == 10;
else if (income <= 61300)
percent == 15;
else if (income <= 123700)
percent == 25;
else if (income <= 188450)
percent == 28;
else if (income <= 336550)
percent == 33;
else (income > 336550)
;
percent == 35;
}
}

I run the program and this is how it goes.
Income: (insert any number here)
Your tax bracket is 0%
Any ideas? Thanks.
Few things u need to correct.

1. U never call the function computeTax() in the main
2. The function computeTax() didnt return any int value
3.
1
2
 if(income <=15100)
    percent =15. 

not
percent==15
double equals only used inside the condition check like if or while.
4. u cannot insert condition in where there is only else
else(income>336550)
it should be either
1
2
else
percent=35;

or
1
2
else if(income>336550)
percent=35;
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
33
34
35
36
#include <iostream>
using namespace std;
 

int computeTax( float income );
 
int main()
{
   float income;
   int percent;

   // prompt the user
   cout << "Income: ";
   cin >> income;

   percent = computeTax( income );

   cout << "Your tax bracket is " << percent << "%" << endl;

   return 0;
}
 
int computeTax( float income )
{
   int percent;

   if ( income <= 15100.0 ) percent = 10;
   else if ( income <= 61300.0 ) percent = 15;
   else if ( income <= 123700.0 ) percent = 25;
   else if ( income <= 188450.0 ) percent = 28;
   else if (income <= 336550.0 ) percent = 33;
   else percent = 35;

   return percent;
}
 
thank you guys very much! all of it helped and hopefully ill avoid it next time!
Topic archived. No new replies allowed.