Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Передвижение курсора мыши*/
- #include "pch.h"
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- int main()
- {
- int x = 0, y = 0; //начальные координаты
- int step = 10; //шаг передвижения
- char c;
- SetCursorPos(x, y);
- do {
- c = _getch();
- switch(c){
- case 75: SetCursorPos(x-=step, y); cout << "LEFT.\n"; break;
- case 77: SetCursorPos(x+=step, y); cout << "RIGHT.\n"; break;
- case 72: SetCursorPos(x, y-=step); cout << "UP.\n"; break;
- case 80: SetCursorPos(x, y+=step); cout << "DOWN.\n"; break;
- }
- } while(c != 27); // Esc
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement