求C语言编写的表白程序,要代码

求C语言编写的表白程序,要代码,第1张

#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>

int main(int argc, const char argv[])

{

unsigned char a[4] = {230, 136, 145};

unsigned char b[4] = {231, 136, 177};

unsigned char c[4] = {228, 189, 160};

printf("%s%s%s", a, b, c);

return 0;

}

留下qq 不懂问我哦~642233706

//主流系统输出16,如果指针占两个字节,对应16位系统,输出对应为8

struct date

{

long cat;//4

struct date next;//4

double dog;//8

}too;

看我的这个怎么样,花了我几个小时,各种ps画图……一剑穿二心~!

#include<stdioh> 

#include<mathh> 

void main() 

 

 

{

 int a[23][80] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0,1,1,1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,0,3,3,3,0,0,3,0,0,0,3,0,0,3,3,3,3,0,0,3,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,3,0,0,0,3,0,0,3,0,3,0,0,3,3,0,0,3,3,0,3,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,3,0,0,0,3,0,0,3,0,3,0,0,3,3,3,3,3,3,0,3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,3,0,0,0,3,0,0,0,3,0,0,0,3,3,0,0,0,0,0,3,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,0,0,3,0,0,3,3,3,0,0,0,0,3,0,0,0,0,0,3,3,3,0,0,0,3,3,3,3,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

     };

 

 for(int i=0;i<23;i++)

  for(int j=0;j<80;j++)

  {

   if(a[i][j] == 0)

    printf(" ",a[i][j]);

   else if(a[i][j] == 1)

    printf("",a[i][j]);

   else if(a[i][j] == 2)

    printf("o",a[i][j]);

   else if(a[i][j] == 3)

    printf("u",a[i][j]);

  }

   //printf("%d",a[i][j]);

 printf("\n");

}

#include<stdioh>

int main()

{

    char name[30];

    int i;

    float y,x,a;

    printf("输入你最爱的人的名字:");

    scanf("%s",&name);

    printf("%s,我爱你\n",name);

    for (y = 15f; y > -15f; y -= 01f) {

        for (x = -15f; x < 15f; x += 005f) {

            a = x  x + y  y - 1;

            putchar(a  a  a - x  x  y  y  y <= 00f  '' : ' ');

        }

        putchar('\n');

    }

    system("pause");

}

Y-- 是有一个延迟的

那个FOR循环啊 肯定还会继续做 直到Y=0;所以还有52丫

依次是 9%3==0 输出8 7%3!=0 6%3==0输出5 4%3!=0 3%3==0 输出2

1%3!=0

逗号运算的结果是 最后的一个表达试,

循序没有变

以 _ 开头的都可以做标志符 这里的Main 不是main sizeof是一个求变量长度的函数

自己做的~~~~~好辛苦的。。。多少哦给点分哦~~

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/3241167.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-02-15
下一篇2024-02-15

发表评论

登录后才能评论

评论列表(0条)

    保存