calendar.cpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 71 行
CPP
71 行
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#ifdef __OS2__
#define INCL_VIO
extern "C" {
#include <os2.h>
};
#else
#include <dos.h>
#endif
#define FEBRUARY 1
#define NARROW 3
#define WIDE 4
static int Jump[ 12 ] = { 1, 4, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6 };
static int MonthDays[ 12 ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static char *MonthName[ 12 ] = { "January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December" };
static char *WideTitle = { "Sun Mon Tue Wed Thu Fri Sat" };
static char *NarrowTitle = { "Su Mo Tu We Th Fr Sa" };
void PosCursor( int row, int col )
/********************************/
{
#ifdef __OS2__
VioSetCurPos( row, col, 0 );
#else
union REGS regs;
regs.w.dx = (unsigned short)(( row << 8 ) + col - 0x0101);
regs.h.bh = 0;
regs.h.ah = 2;
#ifdef __386__
int386( 0x10, ®s, ®s );
#else
int86( 0x10, ®s, ®s );
#endif
#endif
}
void Line( int row, int col, int width, char left, char centre, char right )
/**************************************************************************/
{
char buffer[ 80 ];
buffer[ 0 ] = left;
memset( &buffer[ 1 ], centre, width );
buffer[ width + 1 ] = right;
buffer[ width + 2 ] = '\0';
PosCursor( row, col );
printf( buffer );
fflush( stdout );
}
void Box( int row, int col, int width, int height )
/*************************************************/
{
register int i;
Line( row, col, width, '
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?