Discuz! Board

 找回密码
 立即注册
查看: 488|回复: 0

9.22 1.0 时钟

[复制链接]

51

主题

54

帖子

8724

积分

论坛元老

Rank: 8Rank: 8

积分
8724

大牙狸 Lv:12
发表于 2022-9-22 19:13:52 | 显示全部楼层 |阅读模式
#include<bits/stdc++.h>
#include <windows.h>
using namespace std;
void gotoxy(HANDLE hout, int x, int y);

void gotoxy(HANDLE hout, int x, int y){
  COORD pos;
  pos.X = x;
  pos.Y = y;
  SetConsoleCursorPosition(hout, pos);
};

int main(){
          HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
                int a,f,m,b;
                cin>>b;
                for(int i=1;i<=b;i++)
        {
                m++;
                if(m==60)
                {
                        m=0;
                        f++;
                        if(f==60)
                        {
                                f=0;
                                a++;
                                if(a==24)
                                {
                                        a=0;
                                }
                        }
                }
                if(m<10)
                {
                        cout<<a<<":"<<f<<":"<<m<<endl;
                }
        Sleep(1000);
        gotoxy(hout,0,0);
        }       

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|DiscuzX

GMT+8, 2025-7-18 12:00 , Processed in 0.051091 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.. 技术支持 by 巅峰设计

快速回复 返回顶部 返回列表