终于搞出来计时器1.0了
  • 板块灌水区
  • 楼主df_0
  • 当前回复7
  • 已保存回复7
  • 发布时间2024/8/14 11:46
  • 上次更新2024/8/14 14:19:23
查看原帖
终于搞出来计时器1.0了
709043
df_0楼主2024/8/14 11:46
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h> 
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline void SetColorAndBackground(int ForgC, int BackC) {
    WORD wColor =((BackC & 0x0F) << 4)+(ForgC & 0x0F);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
inline void color(int a){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);}
inline void gto(int x,int y){//将打字的光标移到x行y列
    COORD pos;pos.X=y*2;pos.Y=x;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
/*-初始化 
1.移除快速编辑模式和移除插入模式
2.隐藏控制台光标 
*/
inline void gamecsh(){
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode &= ~ENABLE_QUICK_EDIT_MODE;  //移除快速编辑模式
    mode &= ~ENABLE_INSERT_MODE;      //移除插入模式
    mode &= ~ENABLE_MOUSE_INPUT;
    SetConsoleMode(hStdin, mode);
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
//必须反过来
//y*2是因为汉字是2个字符
inline void gtoxy(int y,int x){
    x-=1;y-=1;
    swap(x,y);
    COORD pos;pos.X=y*2;pos.Y=x;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
inline void scstring(int y,int x, int colora,char a[150]){//输出字符串 
    x-=1;
    y-=1;
    swap(x,y);
    color(colora),gto(x,y);
    for(int i=0;i<strlen(a);i++)putchar(a[i]);
}
inline void puto(int x){//快输 
    if(x<0){
        putchar('-');
        x=-x;
    }
    if(x>=10){
        puto(x/10);
        putchar('0'+x%10);
    }
    else putchar('0'+x);
}
inline void scint(int y,int x,int colora,int a){//输出数字 
    x-=1,y-=1;
    swap(x,y);
    color(colora),gto(x,y),puto(a);
}
inline void GetPos(POINT &pt){//获得鼠标相对于屏幕的位置
    //POINT是自带类型
    HWND hwnd=GetForegroundWindow();
    GetCursorPos(&pt);
    ScreenToClient(hwnd,&pt);
    pt.y=pt.y/16,pt.x=pt.x/16;//除以16,想不明白自己把它去掉试试
}
struct Button{//按钮类型
    int x,y,color,color2;//按钮位置和颜色
    const char *name;//名字
    int len;//名字的长度
    bool sfanx,dycsfanx,gs;//当前状态(是否按下按钮) 按钮有没有按下第一次 格式(按钮样式)  
    int dq,zq;//现在,之前鼠标是否在按钮上 
    bool yjz;//按钮是否进行预加载 
    bool sfzx;//按钮是否注销
    int dqan,zqan;// 现在,之前按钮是否被按下 
};
/*
Bewbutton 
x:定义新按钮在控制台的x坐标
y:定义新按钮在控制台的y坐标
color:定义新按钮未点击的颜色(1-256)
color2:定义鼠标移动到按钮的颜色(1-256)
gs:定义新按钮的样式(单击和常亮)(false/true) 
name:定义新按钮的名字 
*/
inline Button NewButton(int y,int x,int color,int color2,bool gs,const char *name){
    y-=1,x-=1;
    swap(x,y);
    Button t;
    t.x=x,t.y=y,t.name=name;
    t.color=color;
    t.color2=color2;
    t.len=strlen(name);
    t.sfanx=false;
    t.dycsfanx=false;
    t.gs=gs;
    t.zq=t.dq=1;
    t.yjz=false;
    t.sfzx=false;
    return t;
}
inline Button NewButton(int y,int x,bool gs,const char *name){
    y-=1,x-=1;
    swap(x,y);
    Button t;
    t.x=x,t.y=y,t.name=name;
    t.color=7;
    t.color2=8;
    t.len=strlen(name);
    t.sfanx=false;
    t.dycsfanx=false;
    t.gs=gs;
    t.zq=t.dq=1;
    t.yjz=false;
    t.sfzx=false;
    return t;
}
inline int Preserve(Button &A){//鼠标是否按下按钮 
    if(A.sfzx)return false;
    POINT pt;
    GetPos(pt);
    if(A.dq!=A.zq||!A.yjz) {
        A.yjz=true;
        if(A.gs){
            if(A.sfanx)color(A.color2);
            else color(A.color);
            A.yjz=true;
        }
        else color(A.color);
        gto(A.x,A.y);
        printf("%s",A.name);
    }
    if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2)){
        A.dq=1;
        if(A.dq!=A.zq||(A.gs&&A.dqan!=A.zqan)){
            if(A.gs){
                if(A.sfanx)color(A.color);
                else color(A.color2);
            }
            else color(A.color2);
            gto(A.x,A.y);
            printf("%s",A.name);
        }
        if(KEY_DOWN(VK_LBUTTON)||KEY_DOWN(VK_MBUTTON)|KEY_DOWN(VK_RBUTTON)) {
            //while(KEY_DOWN(VK_LBUTTON)||KEY_DOWN(VK_MBUTTON)||KEY_DOWN(VK_RBUTTON));
            if(!A.dycsfanx)A.dycsfanx=true;
            if(A.gs){
             A.sfanx=!A.sfanx;
                if(A.gs){
                    if(A.sfanx)color(A.color);
                    else color(A.color2);
                }
                else color(A.color2);
                gto(A.x,A.y);
                printf("%s",A.name);
            }
            A.zqan=A.dqan;
            if(KEY_DOWN(VK_LBUTTON))A.dqan=1;
            else if(KEY_DOWN(VK_MBUTTON))A.dqan=2;
            else if(KEY_DOWN(VK_RBUTTON))A.dqan=3;
            A.zq=A.dq;
            if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2))A.dq=1;
            else A.dq=0; 
            Sleep(50);
            if(!A.gs)return A.dqan;//检测到点击按钮
            Sleep(150);
            return A.sfanx;
        }
    }
    A.zqan=A.dqan;
    if(KEY_DOWN(VK_LBUTTON))A.dqan=1;
    else if(KEY_DOWN(VK_MBUTTON))A.dqan=2;
    else if(KEY_DOWN(VK_RBUTTON))A.dqan=3;
    else A.dqan=0;
    A.zq=A.dq;
    if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2))A.dq=1;
    else A.dq=0; 
    return A.sfanx;
}
inline bool Preservexy(Button &A){//鼠标是否移动到按钮 
    if(A.sfzx)return false;
    POINT pt;
    GetPos(pt);
    if(A.dq!=A.zq||!A.yjz){
        A.yjz=true;
        gto(A.x,A.y),color(A.color),printf("%s",A.name);
    }
    if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2)){
        A.dq=1;
        if(A.dq!=A.zq)color(A.color2),gto(A.x,A.y),printf("%s",A.name);
        A.zq=A.dq;
        if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2))A.dq=1;
        else A.dq=0;
        return 1;
    }
    A.zq=A.dq;
    if(pt.y==A.x&&(pt.x>=A.y&&pt.x<=A.y+A.len/2))A.dq=1;
    else A.dq=0;
    return 0;//没有检测到
}
inline void zxButton(Button &A){//注销按钮 
    A.len=strlen(A.name);
    A.sfzx=true;
    gto(A.x,A.y);
    for(int i=0;i<A.len;i++)putchar(' ');
}
inline void hfButton(Button &A){//恢复按钮 
    A.sfzx=false;
    A.yjz=false;
}
inline void Buttonname(Button &A,const char *name){//更改按钮名字 
    gto(A.x,A.y);
    for(int i=0;i<A.len;i++)putchar(' ');
    A.name=name;
    A.len=strlen(name);
    A.dq=1;
    A.zq=0;
    A.yjz=false;
}
inline void Buttonxy(Button &A,int y,int x){//更改按钮位置 
    swap(x,y);
    x-=1;
    y-=1;
    A.yjz=false;
    A.x=x;
    A.y=y;
}
inline void Buttoncolor(Button &A,int color,int color2){//更改按钮的显示颜色
    A.yjz=false;
    A.color=color;
    A.color2=color2;
}
inline void hideButton(Button A){//隐藏按钮 
    gto(A.x,A.y);
    for(int i=0;i<A.len;i++)putchar(' ');
}
inline void showButton(Button A){//显示按钮 
    A.yjz=false; 
    Preservexy(A);
}
struct Huagan { //滑杠类型
    int x, y, color, color2; //滑杠位置和颜色
    const char *name;//名字
    int len;//名字的长度
    bool sfanx, dycsfanx; //当前状态(滑杠是否按下) 是否有第一次按下
    int dq, zq; //现在,之前鼠标是否在滑杠上
    bool yjz;//是否进行预加载
    int dqan, zqan; // 现在,之前是否被按下
    int hgz, hgy; //滑杠左边界 和 右边界
    int fw;//滑杠滑动的范围
    int sxzy;//滑杠滑动是上下(1)还是左右(2)? 
};
inline Huagan NewHuagan_z(int y, int hgz, int hgy, int color, int color2, const char *name) {
    Huagan t;
    y -= 1, hgz -= 1;
    t.hgz = hgz;
    swap(hgz, y);
    t.hgy = hgy;
    t.x = hgz, t.y = y, t.name = name;
    t.color = color;
    t.color2 = color2;
    t.len = strlen(name);
    t.sfanx = false;
    t.dycsfanx = false;
    t.zq = t.dq = 1;
    t.yjz = false;
    t.fw = hgy - hgz;
    t.sxzy=1;
    return t;
}
inline Huagan NewHuagan_s(int x, int hgz, int hgy, int color, int color2, const char *name) {
    Huagan t;
    x -= 1, hgz -= 1;
    t.hgz = hgz;
    swap(hgz, x);
    t.hgy = hgy;
    t.x = x, t.y = hgz, t.name = name;
    t.color = color;
    t.color2 = color2;
    t.len = strlen(name);
    t.sfanx = false;
    t.dycsfanx = false;
    t.zq = t.dq = 1;
    t.yjz = false;
    t.fw = hgy - hgz;
    t.sxzy=2;
    return t;
}
inline Huagan NewHuagan_z(int y, int hgz, int hgy, const char *name) {
    Huagan t;
    y -= 1, hgz -= 1;
    t.hgz = hgz;
    swap(hgz, y);
    t.hgy = hgy;
    t.x = hgz, t.y = y, t.name = name;
    t.color = 7;
    t.color2 = 8;
    t.len = strlen(name);
    t.sfanx = false;
    t.dycsfanx = false;
    t.zq = t.dq = 1;
    t.yjz = false;
    t.fw = hgy - hgz;
    t.sxzy=1;
    return t;
}
inline Huagan NewHuagan_s(int x, int hgz, int hgy, const char *name) {
    Huagan t;
    x -= 1, hgz -= 1;
    t.hgz = hgz;
    swap(hgz, x);
    t.hgy = hgy;
    t.x = x, t.y = hgz, t.name = name;
    t.color = 7;
    t.color2 = 8;
    t.len = strlen(name);
    t.sfanx = false;
    t.dycsfanx = false;
    t.zq = t.dq = 1;
    t.yjz = false;
    t.fw = hgy - hgz;
    t.sxzy=2;
    return t;
}
inline int Preserve(Huagan &A) { //鼠标是否按下滑杠
    POINT pt;
    GetPos(pt);
    if (A.dq != A.zq || !A.yjz) {
        A.yjz = true;
        color(A.color);
        gto(A.x, A.y), printf("%s", A.name);
    }
    if (pt.y == A.x && (pt.x >= A.y && pt.x <= A.y + A.len / 2)) {
        A.dq = 1;
        if (A.dq != A.zq) {
             color(A.color2);
             gto(A.x, A.y), printf("%s", A.name);
        }
        if (!A.dycsfanx)A.dycsfanx = true;
        if (A.sfanx)A.sfanx = false;
        else A.sfanx = true;
        A.zqan = A.dqan;
        if (KEY_DOWN(MOUSE_MOVED))A.dqan = 1;
        else A.dqan = 0;
        A.zq = A.dq;
        if (pt.y == A.x && (pt.x >= A.y && pt.x <= A.y + A.len / 2))A.dq = 1;
        else A.dq = 0;
        Sleep(100);
        return 1;
    }
    A.zqan = A.dqan;
    if ( KEY_DOWN(VK_LBUTTON))A.dqan = 1;
    else A.dqan = 0;
    A.zq = A.dq;
    if (pt.y == A.x && (pt.x >= A.y && pt.x <= A.y + A.len / 2))A.dq = 1;
    else A.dq = 0;
    return 0;
}
inline void showHuagan(Huagan A) { //显示滑杠
    A.yjz=false; 
    Preserve(A);
}
inline void hideHuagan(Huagan A) { //隐藏滑杠
    gto(A.x, A.y);
    for (int i = 0; i < A.len; i++)putchar(' ');
}
inline void Huaganname(Huagan &A, const char *name) { //更改滑杠名字
    gto(A.x, A.y);
    for (int i = 0; i < A.len; i++)putchar(' '); //擦除原名字
    A.name = name;
    A.len = strlen(name);
    A.dq = 1;
    A.zq = 0;
    showHuagan(A);
}
inline void Huaganxy(Huagan &A, int y, int x) { //更改滑杠位置
    swap(x, y);
    x -= 1;
    y -= 1;
    hideHuagan(A);
    A.x = x;
    A.y = y;
    showHuagan(A);
}
inline void Huagancolor(Huagan &A, int color, int color2) { //更改滑杠显示颜色
    A.color = color;
    A.color2 = color2;
    showHuagan(A);
}
inline int moveHuagan(Huagan &A) {//移动滑杠
    if (Preserve(A)) {
        POINT pt;
        int zqx=A.y;
        if(A.sxzy==2)zqx = A.x;
        while (KEY_DOWN(VK_LBUTTON)) {
            GetPos(pt);
            if ((A.sxzy==2&&pt.y >= A.hgz  && pt.y <= A.hgy - 1 && pt.y >= A.x - A.fw && pt.y <= (A.x + A.len / 2) + A.fw && zqx != pt.y)||(A.sxzy==1&&pt.x >= A.hgz  && pt.x <= A.hgy - 1 && pt.x >= A.y - A.fw && pt.x <= (A.y + A.len / 2) + A.fw && zqx != pt.x)) {
                hideHuagan(A);
                if(A.sxzy==1)A.y = pt.x;
                else A.x=pt.y;
                gtoxy(A.x + 1, A.y + 1);
                puts(A.name);
            }
            if(A.sxzy==1)zqx = A.y;
            else zqx=A.x;
        }
    }
    if(A.sxzy==1)return A.y-A.hgz+1;
    return A.x-A.hgz+1;
}
inline void Huaganbk(Huagan A,int colorx,char x) { //滑杠边框绘制
    color(colorx);
    if(A.sxzy==1){
        gtoxy(A.x + 1, A.hgz);
        putchar(x);
        if(A.len%2==0)gtoxy(A.x + 1, A.hgy + A.len / 2);
        else gtoxy(A.x + 1, A.hgy + A.len / 2+1);
        if(A.len%2==0)putchar(' ');
        putchar(x);
        return;
    }
    if(A.len==1)gtoxy(A.x, A.hgz+1);
    else {
        if(A.len<=3)gtoxy(A.x, A.hgz+A.len/2);
        else gtoxy(A.x, A.hgz+A.len/2-(A.len-3)/2);
    }
    for(int i=0;i<A.len;i++)putchar(x);
    if(A.len==1)gtoxy(A.x + 1+ A.fw , A.hgz+1);
    else{
        if(A.len<=3)gtoxy(A.x + 1+ A.fw, A.hgz+A.len/2);
        else gtoxy(A.x + 1+ A.fw, A.hgz+A.len/2-(A.len-3)/2);
    }
    for(int i=0;i<A.len;i++)putchar(x);
}
Button Sa[4],Sj[4],qd=NewButton(7,11,0,"开始"),gl=NewButton(7,7,0,"归零"),ztjx=NewButton(7,7,0,"暂停"),sett=NewButton(7,1,0,"设置");
int hour,minute,second;
int xhour,xminute,xsecond;
double num,qznum,hznum;
int dqnum=-1,okk=1;
int sysjtz=1,sysjbfb=1;
string str="~时间到了!~";
char mnfcc[16][51];
void jsqcsh(){
    color(7); 
    gtoxy(4,5);
    putchar(':');
    gtoxy(4,9);
    putchar(':');
    for(int i=0;i<3;i++){
        int x=3+i*4;
        Sa[i]=NewButton(2,x,0,"+");
        Sj[i]=NewButton(6,x,0,"-");
        gtoxy(4,x);
        puto(0);
    }
    showButton(qd);
    showButton(gl);
}
void drawjdq(int n){
    for(int i=0;i<n;i++)putchar('#');
    for(int i=0;i<10-n;i++)putchar(' ');
}
int main(){
	SetConsoleTitle("计时器");
    gamecsh();
    jsqcsh();
    xhour=xminute=xsecond=hour=minute=second=0; 
    begin:Buttonname(qd,"开始");
    color(7);
    okk=1;
    dqnum=0;
    Buttonname(ztjx,"暂停");
    hideButton(ztjx);
    gtoxy(4,3);
    if(xhour>9||hour<10)puto(xhour);
    else{
        putchar(' ');
        putchar(' ');
        gtoxy(4,3);
        puto(xhour);
    }
    gtoxy(4,7);
    if(xminute>9||minute<10)puto(xminute);
    else{
        putchar(' ');
        putchar(' ');
        gtoxy(4,7);
        puto(xminute);
    }
    gtoxy(4,11);
    if(xsecond>9||second<10)puto(xsecond);
    else{
        putchar(' ');
        putchar(' ');
        gtoxy(4,11);
        puto(xsecond);
    }
    hour=xhour;
    minute=xminute;
    second=xsecond;
    for(int i=0;i<3;i++){
        showButton(Sa[i]);
        showButton(Sj[i]);
    }
    showButton(qd);
    showButton(gl);
    showButton(sett);
    while(1){
        if(Preserve(sett)){
            Sleep(25);
            system("cls");
            sett.yjz=false;
            Button sysjbfbt=NewButton(1,1,0,"剩余时间百分比显示(开启)");
            Button sysjtzt=NewButton(2,1,0,"剩余时间条状显示(开启)");
            Button tscgg=NewButton(3,1,0,"更改提醒词");;
            if(!sysjbfb)Buttonname(sysjbfbt,"剩余时间百分比显示(关闭)");
            if(!sysjtz)Buttonname(sysjtzt,"剩余时间条状显示(关闭)");
            while(!Preserve(sett)){
                if(Preserve(sysjbfbt)){
                    if(sysjbfb)Buttonname(sysjbfbt,"剩余时间百分比显示(关闭)");
                    else Buttonname(sysjbfbt,"剩余时间百分比显示(开启)");
                    sysjbfb=!sysjbfb;
                }
                if(Preserve(sysjtzt)){
                    if(sysjtz)Buttonname(sysjtzt,"剩余时间条状显示(关闭)");
                    else Buttonname(sysjtzt,"剩余时间条状显示(开启)");
                    sysjtz=!sysjtz;
                }
                if(Preserve(tscgg)){
                    system("cls");
                    system("mode con cols=40 lines=10");
                    color(7);
                    printf("请输入新的提醒词:");
                    getline(cin,str);
                    printf("提示词设置成功.\n");
                    system("pause");
                    system("mode con cols=25 lines=8");
                    showButton(sett);
                    showButton(tscgg);
                    showButton(sett);
                }
            }
            Sleep(25);
            hideButton(tscgg);
            hideButton(sysjbfbt);
            hideButton(sysjtzt);
            jsqcsh();
        }
        if(Preserve(gl)){
            color(7);
            int zhour=hour,zminute=minute,zsecond=second;
            hour=minute=second=0;
            if(zhour!=0){
                gtoxy(4,3);
                putchar('0');
                if(zhour>=10)putchar(' ');
            }
            if(zminute!=0){
                gtoxy(4,7);
                putchar('0');
                if(zminute>=10)putchar(' ');
            }
            if(zsecond!=0){
                gtoxy(4,11);
                putchar('0');
                if(zsecond>=10)putchar(' ');
            }
        }
        if(Preserve(qd))break;
        for(int i=0;i<3;i++){
            if(Preserve(Sa[i])){
                color(7);
                if(i==0){
                    gtoxy(4,3);
                    if(hour<23){
                        hour++;
                        puto(hour);
                    }
                    else {
                        hour=0;
                        putchar('0');
                        putchar(' ');
                    }
                }
                if(i==1){
                    gtoxy(4,7);
                    if(minute<59){
                        minute++;
                        puto(minute);
                    }
                    else {
                        minute=0;
                        putchar('0');
                        putchar(' ');
                    }
                    
                }
                if(i==2){
                    gtoxy(4,11);
                    if(second<59){
                        second++;
                        puto(second);
                    }
                    else{
                        second=0;
                        putchar('0');
                        putchar(' ');
                    }
                }
                Sleep(25);
            }
            if(Preserve(Sj[i])){
                color(7);
                if(i==0){
                    if(hour>0)hour--;
                    else hour=23;
                    gtoxy(4,3);
                    if(hour==9){
                        putchar('9');
                        putchar(' ');
                    }
                    else puto(hour);
                }
                if(i==1){
                    if(minute>0)minute--;
                    else minute=59;
                    gtoxy(4,7);
                    if(minute==9){
                        putchar('9');
                        putchar(' ');
                    }
                    else puto(minute);
                }
                if(i==2){
                    if(second>0)second--;
                    else second=59;
                    gtoxy(4,11);
                    if(second==9){
                        putchar('9');
                        putchar(' ');
                    }
                    else puto(second);
                }
                Sleep(25);
            }
        }
    }
    xhour=hour;
    xminute=minute;
    xsecond=second;
    hznum=(double)(xhour*3600+xminute*60+xsecond);
    qznum=hznum;
    num=100.0000;
    Buttonname(qd,"停止");
    for(int i=0;i<3;i++)hideButton(Sa[i]);
    for(int i=0;i<3;i++)hideButton(Sj[i]);
    hideButton(gl);
    hideButton(sett);
    int nowtime=time(0),justtime=time(0); 
    color(7);
    if(xhour+xminute+xsecond!=0){
        if(sysjbfb){
            gtoxy(1,1);
            printf("100.0000");
            putchar('%');
        }
        if(sysjtz){
            if(!sysjbfb)gtoxy(1,4);
            putchar(' ');
            for(int i=0;i<10;i++)putchar('#');
        }
    }
    showButton(ztjx);
    while(hour!=0||minute!=0||second!=0){
        if(Preserve(ztjx)){
            Buttonname(ztjx,"继续");
            Sleep(25);
            while(!Preserve(ztjx)){
               if(Preserve(qd))goto endtostart;
            }
            justtime=time(0);
            nowtime=justtime;
            Buttonname(ztjx,"暂停");
        }
        if(Preserve(qd))goto endtostart;
        nowtime=time(0);
        if(nowtime!=justtime){
            color(7);
            second--;
            if(second==-1){
                if(minute>0){
                    minute--;
                    second=59;
                    gtoxy(4,7);
                    if(minute==9){
                        putchar('9');
                        putchar(' ');
                    }
                    else puto(minute);
                }
                else{
                    if(hour>0){
                        hour--;
                        minute=59;
                        second=59;
                        gtoxy(4,3);
                        if(hour==9){
                            putchar('9');
                            putchar(' ');
                        }
                        else puto(hour);
                        gtoxy(4,7);
                        if(minute==9){
                            putchar('9');
                            putchar(' ');
                        }
                        else puto(minute);
                    }
                }
            }
            if(sysjtz||sysjbfb){
                qznum=(double)(hour*3600+minute*60+second*1);
                num=qznum/hznum*100.0;
            }
            if(sysjbfb&&okk==1){
                gtoxy(1,1);
                for(int i=0;i<7;i++)putchar(' '); 
                okk=0;
            }
            if(sysjbfb){
                gtoxy(1,1);
                if(num>=10)printf("%.4lf",num);
                else{
                    for(int i=0;i<6;i++)putchar(' ');
                    gtoxy(1,1);
                    printf("%.4lf",num);
                }
                putchar('%');
                putchar(' ');
                putchar(' ');
            }
            if(sysjtz){
                if(!sysjbfb){
                    gtoxy(1,4);
                    putchar(' ');
                }
                if(dqnum!=10&&num<=100.00&&num>=90.00)dqnum=10;
                else if(dqnum!=9&&num<90.00&&num>=80.00)dqnum=9;
                else if(dqnum!=8&&num<80.00&&num>=70.00)dqnum=8;
                else if(dqnum!=7&&num<70.00&&num>=60.00)dqnum=7;
                else if(dqnum!=6&&num<60.00&&num>=50.00)dqnum=6;
                else if(dqnum!=5&&num<50.00&&num>=40.00)dqnum=5;
                else if(dqnum!=4&&num<40.00&&num>=30.00)dqnum=4;
                else if(dqnum!=3&&num<30.00&&num>=20.00)dqnum=3;
                else if(dqnum!=2&&num<20.00&&num>=10.00)dqnum=2;
                else if(dqnum!=1&&num<=10.00&&num>=00.00)dqnum=1;
                drawjdq(dqnum-1);
            }
            gtoxy(4,11);
            if(second==9){
                putchar('9');
                putchar(' ');
            }
            else puto(second);
            justtime=time(0);
        }
    }
    hideButton(ztjx);
    hideButton(qd);
    end:
    MessageBox(NULL,str.c_str(),"计时器",MB_SYSTEMMODAL);
    endtostart:
    if(sysjbfb){
        gtoxy(1,1);
        for(int i=0;i<9;i++)putchar(' ');
    }
    if(sysjtz){
        if(!sysjbfb)gtoxy(1,4);
        putchar(' ');
        for(int i=0;i<11;i++)putchar(' ');
    }
    goto begin;
    return 0;
}
2024/8/14 11:46
加载中...