程序员们很辛苦,每天都得加班加点的来工作。所以你要送上贴心的小惊喜,温暖一下程序员的心。还要多给程序员们送秋波,要好感度嗷嗷上升。要投其所好的把你的。电脑桌面设置成你表白的话,让他看到满满的爱意。还有就是,嗯,蜡烛玫瑰,创造出浪漫的环境。大胆的说出你的爱意。
#define IdYes 1002
#define IdNo 1003
#define IdStatic 1004
#define IdTimer 1005
#define Width 640
#define Height 480
#define Tick 2000
#include<windowsh>
int x,y;
RECT rdesk;
HINSTANCE hinst;
HWND hyes,hno;
BOOL quit=FALSE;
LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rclient;
HBRUSH hbrbkgnd;
static COLORREF c;
static BYTE r,g,b;
switch(Message)
{
case WM_TIMER:
if(IdTimer==LOWORD(wParam))
{
r=(BYTE)(rand()%256);
g=(BYTE)(rand()%256);
b=(BYTE)(rand()%256);
c=RGB(r,g,b);
InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd);
}
break;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
hbrbkgnd=CreateSolidBrush(c);
SelectObject(hdc,hbrbkgnd);
GetClientRect(hwnd,&rclient);
FillRect(hdc,&rclient,hbrbkgnd);
DeleteObject(hbrbkgnd);
EndPaint(hwnd,&ps);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IdYes:
quit=TRUE;
MessageBox(hwnd,TEXT("回答正确,太太太好了!"),TEXT("宝贝"),MB_ICONEXCLAMATION|MB_OK);
SendMessage(hwnd,WM_CLOSE,0,0);
break;
case IdNo:
MessageBox(hwnd,TEXT("回答错误哦,我很生气呢!"),TEXT("宝贝"),MB_ICONEXCLAMATION|MB_OK);
break;
}
break;
case WM_SIZE:
case WM_MOVE:
SetWindowPos(hwnd,HWND_TOPMOST,x,y,Width,Height,SWP_SHOWWINDOW);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
if(quit)
{
KillTimer(hwnd,IdTimer);
DestroyWindow(hwnd);
}
break;
case WM_CREATE:
CreateWindow(TEXT("Static"),
TEXT("请回答:做我女朋友好吗?"),
WS_CHILD|WS_VISIBLE|SS_CENTER,
200,
200,
240,
20,
hwnd,
(HMENU)IdStatic,
hinst,
NULL
);
hyes=CreateWindow(TEXT("Button"),
TEXT("好"),
WS_CHILD|WS_VISIBLE|BS_CENTER,
270,
230,
45,
20,
hwnd,
(HMENU)IdYes,
hinst,
NULL
);
hno=CreateWindow(TEXT("Button"),
TEXT("不好"),
WS_CHILD|WS_VISIBLE|BS_CENTER,
325,
230,
45,
20,
hwnd,
(HMENU)IdNo,
hinst,
NULL
);
SetTimer(hwnd,IdTimer,Tick,NULL);
break;
default:
return DefWindowProc(hwnd,Message,wParam,lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
hinst=hInstance;
srand(time(NULL));
memset(&wc,0,sizeof(wc));
wccbSize=sizeof(WNDCLASSEX);
wclpfnWndProc=WndProc;
wchInstance=hInstance;
wchCursor=LoadCursor(NULL,IDC_ARROW);
wchbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wclpszClassName=TEXT("WindowClass");
wchIcon=LoadIcon(NULL,IDI_APPLICATION);
wchIconSm=LoadIcon(NULL,IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL,TEXT("窗口注册失败!"),TEXT("错误"),MB_ICONEXCLAMATION|MB_OK);
return 0;
}
GetWindowRect(GetDesktopWindow(),&rdesk);
x=(rdeskright-Width)/2;
y=(rdeskbottom-Height)/2,
hwnd = CreateWindowEx(WS_EX_TOPMOST,
TEXT("WindowClass"),
TEXT("I Love You"),
WS_THICKFRAME|WS_VISIBLE,
x,
y,
Width,
Height,
NULL,NULL,hInstance,NULL);
if(NULL==hwnd)
{
MessageBox(NULL,TEXT("窗口创建失败!"),TEXT("错误!"),MB_ICONEXCLAMATION|MB_OK);
return 0;
}
while(GetMessage(&msg,NULL,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msgwParam;
}
截图
#include <stdioh>
#include <mathh>
#include <stdlibh>
#define I 20
#define R 340
#include <stringh>
int main()
{
char answer[10];
printf("遇到你\n我才发现\n曾经所有的条件\n似乎都成了我等你的借口\n\n");
printf("我对你的感情已经决堤\n所以\n请允许我,从今往后映入你\n明媚的眼\n");
printf("我\n想和你\n耳鬓厮磨,相濡以沫!");
printf("答应我吧!\n输入yes,你可以看到我的真心\n");
scanf("%s", answer);
float y, x, z, f;
for (y = 15f; y > -15f; y -= 01f)
{
for (x = -15f; x < 15f; x += 005f)
{
z = x x + y y - 1;
f = z zz - x xyyy;
putchar(f <= 00f ""[(int)(f-80f)] : ' ');
}
putchar('\n');
}
long time;
for (;;)
{
system("color a");
for (time = 0; time<99999999; time++);
system("color b");
for (time = 0; time<99999999; time++);
system("color c");
for (time = 0; time<99999999; time++);
system("color d");
for (time = 0; time<99999999; time++);
system("color e");
for (time = 0; time<99999999; time++);
system("color f");
for (time = 0; time<99999999; time++);
system("color 0");
for (time = 0; time<99999999; time++);
system("color 1");
for (time = 0; time<99999999; time++);
system("color 2");
for (time = 0; time<99999999; time++);
system("color 3");
for (time = 0; time<99999999; time++);
system("color 4");
for (time = 0; time<99999999; time++);
system("color 5");
for (time = 0; time<99999999; time++);
system("color 6");
for (time = 0; time<99999999; time++);
system("color 7");
for (time = 0; time<99999999; time++);
system("color 8");
for (time = 0; time<99999999; time++);
system("color 9");
}
getchar();
return 0;
}
运行效果:
扩展资料:
printf函数使用注意事项
1、域宽
%d:按整型数据的实际长度输出。
如果想输出指定宽度可以指定域宽,%md--&gt;m域宽,打印出来以后,在控制台上,显示m位;
如果我们要打印的数的位数如果超过我们设定m则原样输出;
如果我们要打印的数的位数如果小于我们设定的位数,则补空白,具体如下:
如果m为正数,则左对齐(左侧补空白);
如果m为负数,则右对齐(右侧补空白)。
2、转义字符
如果想输出字符"%",则应该在“格式控制”字符串中用连续两个%表示。
如:printf("%f%%",1.0/3);输出结果:0.333333%。
欢迎分享,转载请注明来源:表白网
评论列表(0条)