Calculate with pointers?

Jun 11, 2017 at 8:35pm
Hello, I want to create a little program... As first it should save the current Mouse position.
Then it should save it again after some seconds but this time in another pointer.
After that I want the diffrence saved in another var but this time in an int.

But _pointer - _pointer2 = diffrence; dont work.

I would be happy if you can help me
example code:
1
2
3
4
5
6
7
8
9
  cout << "First Position:";
	Sleep(3000);
	GetCursorPos(&_calcPlayer);
	cout << "Second Position";
	Sleep(3000);
	GetCursorPos(&_calcEnemy);
	system("CLS");
	cout << "Calculation..." << endl;
	_calcPlayer - _calcEnemy = int diffrence;
Jun 11, 2017 at 11:52pm
After that I want the diffrence saved in another var but this time in an int.

What do you mean by difference? The distance between the points? The vector to the first point relative to the second point? The other way around?
Jun 12, 2017 at 12:05pm
I mean the diffrence between Point 1 and point 2
Jun 12, 2017 at 12:46pm
What is the type of _calcPlayer and _calcEnemy?
What does the GetCursorPos() do?

One does not simply "save something in a pointer". Pointers store memory addresses. A pointer can point to an object. That object usually stores a value.


A "cursor position" (or "point") sounds like a (mathematical) 2D vector. How does one compute the "difference" of positions? Is the difference a boolean, vector, or distance? If a distance, then euclidean, manhattan, or what?
Topic archived. No new replies allowed.