如果你的孩子(或你),喜欢编程,一定要学c++。
因为如果c++学好了,电脑就没了。
不是我夸张,我才学了两个月,就差点把鼠标毁了。
代码如下(控制鼠标)
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
using namespace std;
int main(){
system("color 0a");
POINT mouse;
srand(time(0));
while(1){
GetCursorPos(&mouse);
mouse.x=rand()%1920;
mouse.y=rand()%1080;
//cout<<mouse.x<<","<<mouse.y<<endl;
SetCursorPos(mouse.x,mouse.y);
Sleep(10);
}
return 0;
}
还有读取鼠标位置:
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
using namespace std;
int main(){
system("color 0a");
POINT mouse;
srand(time(0));
while(1){
GetCursorPos(&mouse);
cout<<mouse.x<<","<<mouse.y<<endl;
Sleep(10);
}
return 0;
}
哈哈,如果被我坑了,不要踩哟