c 的简单时钟

//object: creat a clock 
//writer: mike
//time: 2020.09.10

#include<stdio.h>
#include<Windows.h>
#include<stdlib.h>
int main(void)
{
    int h = 0, m = 0, s = 0;
    printf("please inpyt the time such as  hour:minute:second");
    scanf("%d%d%d",&h, &m, &s);
    system("cls");
    for(h; h <24; h++)
        {
            for(m; m<60; m++)
                {

                    for(s; s<60; s++)
                        {
                            system("cls");
                            printf("\n\n\n\t\t\t%d:%d:%d", h, m, s);
                            
                            if(h<12)
                                {
                                    printf("AM");
                                }
                            else
                            {
                                printf("PM");
                            }
                            printf("\n\n\n\t\tFriday september 10th 2020");
                            Sleep(1000);

                        }
                    s = 0;
                }
            m = 0;
        }
    h = 0;
    getchar();
    getchar();

    return 0;
}

//总体感觉表走的不准,很慢,可能和清屏函数有关。

不过我能查到的清屏函数也就是 cls了。

 

 

posted @ 2020-09-10 23:50  看星星的派大星  阅读(139)  评论(0编辑  收藏  举报