Error of Redefinition of formal Parameter "X"

I am trying to make a payroll calculator, and I have made the code section where it compares the gross income and then returns the correct value back to the main code block. But everytime I keep trying to compile i get this error..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>



double nTax(int x)
{	
	int x = 27;  //this is where it says the error of redefinition of x              

	if (x > 820 && x < 840)
		int x = x + 2;
	if (x > 840 && x < 860)
		int x = x + 2*2;
	if (x>860 && x < 880)
		int x = x + 2*3;              // $820 to 920
	if (x > 880 && x < 900)
		int x = x + 2*4;
	if (x>900 && x < 920)
		int x = x + 3+(2*4);
nTax function receive an int parameter which has the same name - x
double nTax(int x) // definition of x
Last edited on
Topic archived. No new replies allowed.