注册 登录
编程论坛 C++ Builder

请帮忙注释一段代码,谢谢啦!

晴雨135 发布于 2014-08-21 11:29, 1520 次点击
void wenhou()
{
    char why[5][28] = {"晚上好!","下午好!","中午好!","早上好!","夜晚好,注意休息!"};
    char g_wenhou[30];
    int j = 0;
    int id = 0;
    time_t cur;
    time(&cur);
    struct tm *ti = localtime(&cur);
    int ft = 1, pleft,ptop,pright,pbottom;

    window_getviewport(&pleft, &ptop, &pright, &pbottom);
    if(ti->tm_hour >= 19)
        id = 0;
    else if(ti->tm_hour >= 14)
        id = 1;
    else if(ti->tm_hour >= 12 )
        id = 2;
    else if(ti->tm_hour >= 6)
        id = 3;
    else if(ti->tm_hour >= 0)
        id = 4;
    strcpy(g_wenhou,why[id]);
    setbkmode(TRANSPARENT);
    for(; j < 2; j ++)
    {
        for(int i = 0,c = 0; i < 500; i++)
        {
            if(kbmsg())
            {
                getkey();
                j = 2;
                i = 500;
            }
            if(i < 255)
            {
                c++;
                delay_fps(150);
            }
            else if(i > 255)
            {
                c--;
                delay_fps(200);
            }
            else
                delay_ms(500);
            setcolor(LIGHTBLUE);
            setbkcolor(LIGHTGREEN);
            setfont(40, 25, "幼圆");
            xyprintf( (pright - strlen(g_wenhou) * 30 )/2, (float)pbottom/2.3, "%s" ,g_wenhou);
            setfont(26,16,"楷体");
            xyprintf(pright/2-80,pbottom-100,"任意键跳过");
        }
        cleardevice();
        strcpy(g_wenhou , "我好饿,快开饭吧!");
    }
1 回复
#2
T_MACC2015-07-12 13:25
虽然  好多看不懂 问下  c++ builder  是一门  怎样的语言???
1