#include <stdio.h>
#include <Windows.h>
#include <time.h>
int main()
{
srand((unsigned int)time((NULL)));
int a<5>={0};//最好初始化
for (int i=0;i<5;i++)
{
a=rand()%10;
printf("%d\n",a);
}
printf("----------------------\n");
int kmax=0;//记录最大值下标
for (int i=0;i<4;i++)
{
kmax=i;
for (int j=i+1;j<5;j++)
{
if (a
{
kmax=j;
}
if (kmax!=i)//交换找到的最大数与原来最大数
{
int temp;
temp=a
a
a=temp;
}
}
}
————————————————————————————————————————————
输出排序后的值
for (int i=0;i<5;i++)
{
printf("%d",a);
}
getchar();
return 0;
}
调戏窗口
#include <stdio.h>
#include <Windows.h>
void open()
{
ShellExecuteA(0,"open","\"D:\\Program Files (x86)\\Tencent\\TIM\\Bin\\QQScLauncher.exe\"",0,0,1);//系统函数打开软件
}
void move()
{
HWND win=FindWindowA("TXGuiFoundation","TIM");//找句柄类名标题用的spy软件获得
while (win==NULL)
{
printf("失踪");
}
int i=0;
while (i<900)
{
SetWindowPos(win,NULL,16*i/9,i,1,4,1);//设置位置(坐标,长宽)
Sleep(200);
i+=10;
if (i/10%2==1)
{
ShowWindow(win,SW_HIDE);//隐藏窗口
}
else
{
ShowWindow(win,SW_SHOW);//显示窗口
}
}
}
int main()
{
system("taskkill /f /im TIM.exe ");//结束进程
Sleep(3000);
open();
Sleep(3000);
move();
system("pause");
return 0;
}
TAG:[db:关键词]