Even numbers?

Having the user enter in two numbers and generate even numbers between those numbers. In my code here, when it performs, I usualy get two extra numbers. For instance user enters 0 and 10

what I will get is 0, 2, 4, 6, 8, 10,12

I know my number++ is incorrect. im thinking of adding two to it but don't know how. Anyone out here?

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
37
38
39
40
  int _tmain(int argc, _TCHAR* argv[])
{

	//Declare a number the user will enter
	int number1;
	int number2;
	int even;
	int odd;

	//Tell user to enter a number
	cout<<"\n\tEnter in two numbers: ";
	cin>>number1;
	cout<< " " ;
	cin>>number2;

	
	//whle loop
	if (number2<number1)
	{
		cout<<"number 2 will now be ";
		number2=number1;
		number1=number2;
		cout<<number2;
	}

	//Declare a counter to calculate even number

	int counter;
	counter=0;
	cout<<"even: ";
	while (number1<=number2)
	{	
		if(number1%2==0)
		{
			even=number1+2;
			cout <<even << " " ;
		}
		number1++;
	}
have you tried
while(number 1< number2)
Yup that helped :D Thank you :)
Topic archived. No new replies allowed.