increasing numbers

the error im getting is "operator has no effect; expected operator with side-effect" on lines 19 25 i also think this is the problem im having on my other program please help me there too http://www.cplusplus.com/forum/beginner/130749/

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
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <cstdlib>
#include <string>

using namespace std;

int main()
{
	bool n=1;

	while (true)
	{


		if (GetAsyncKeyState(VK_UP))
		{
			n + 1;
			cout << n << endl;
			continue;
		}
		else if (GetAsyncKeyState(VK_DOWN))
		{
			n - 1;
			cout << n << endl;
			continue;
		}
	}
}
closed account (j3Rz8vqX)
n+1;//isn't doing anything.

n++;//is incrementing the value of n by 1.
n=n+1;//is incrementing the value of n by 1.

n--;//is decrementing the value of n by 1.
n=n-1;//is decrementing the value of n by 1.
Last edited on
Topic archived. No new replies allowed.