📄 sav_clock.c
字号:
#include <stdio.h>
#include <tinfo.h>
#include <sys/types.h>
#include <sys/timeb.h>
void block();
main()
{
int i;
long ti;
char c[26];
static char w[7]={'u','o','u','e','h','r','a'};
static char m[12]={'n','b','r','r','y','n','l','g','p','t','v','c'};
static char *cs[13]={"0","一","二","三","四","五","六",
"七","八","九","十","十一","十二"};
initscr();
block(5,10,14,60);
move(7,24);
printw("城 市 合 作 银 行 绥 化 中 心 社");
move(9,17);
printw("储 蓄 处 理 系 统 柜 台 业 务 程 序");
move(10,17);
printw("==============================================");
move(LINES-1,26);
standout();
addstr(" == 按 Del 键继续! == ");
standend();
while(1)
{
time(&ti);
strcpy(c,ctime(&ti));
i=25;
if(c[6]=='v'||c[6]=='c')i=24;
if(c[8]=='1'&&c[9]!='0')
i=i-1;
else if(c[8]=='2'||c[8]=='3')
{
if(c[9]!='0')
i=i-2;
else
i=i-1;
}
move(12,i);
printw(" %s%s%s%s%s",cs[c[20]-48],cs[c[21]-48],cs[c[22]-48],
cs[c[23]-48],"年");
for (i=0;i<12;i++)
{
if(c[6]==m[i])break;
}
if(i==2&&c[5]=='p')i=3;
if(i==0&&c[5]=='u')i=5;
printw("%s%s",cs[i+1],"月");
if(c[8]=='2'||c[8]=='3')
printw("%s%s",cs[c[8]-48],"十");
else if(c[8]=='1')
printw("十");
if(c[9]!='0')
printw("%s%s ",cs[c[9]-48],"日");
else
printw("%s","日");
for (i=0;i<7;i++)
{
if(c[1]==w[i])
{
if(i==0&&c[0]=='T')i=2;
move(14,37);
if(i==0)
printw("%s","星期日");
else
printw("%s%s","星期",cs[i]);
break;
}
}
move(16,33);
printw("%c%c%c%c%c%c%c%c%c%c%c%c%c%c",163,c[11]+128,163,c[12]+128,
c[13],163,c[14]+128,163,c[15]+128,c[16],163,c[17]+128,163,c[18]+128);
refresh();
}
endwin();
return;
}
void block(row,col,h,w)
int row,col,h,w;
{
int i;
move(row,col);
printw("┌");
for(i=1;i<=w/2-2;i++)printw("─");
printw("┐");
for(i=1;i<=h-2;i++)
{
move(row+i,col);
printw("│");
move(row+i,col+w-2);
printw("│");
}
move(row+h-1,col);
printw("└");
for(i=1;i<=w/2-2;i++)printw("─");
printw("┘");
refresh();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -