⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cal.c

📁 生成日历表,计算时间.
💻 C
字号:
/*------------------------------------------------------------------------*
 *  File: cal.c								  *
 *  Author: Brady Tippit  1-26-97					  *
 *									  *
 *  A Unix-like calendar utility built using td.lib and Borland keywords. *                                       
 *                                                                        *
 *  To compile, if your turboc.cfg file has -ms in it use:		  *
 *  bcc cal.c td.lib   otherwise use: bcc -ms cal.c td.lib		  *
 *									  *
 *------------------------------------------------------------------------*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "datelib.h"


int main(int argc, char *argv[])
{
   int theYear, theMonth;
   tdtype *date;	       /* Declare a pointer to a tdtype. */
   

   if(argc == 2 && !strcmp(argv[1], "-?"))
   {
     fprintf(stdout, "\nSyntax: cal [month] [year]\n");
     fprintf(stdout, "Usage: prints out the calendar month for\n");
     fprintf(stdout, "any year from Jan 1, 1 A.D. to Dec 31 32766\n");
     fprintf(stdout, "Example: cal 7 1776, or cal 1 1\n");
     fprintf(stdout, "Remember to give the exact year that\n");
     fprintf(stdout, "you want. Don't abbreviate!\n");
     fprintf(stdout, "For the current month, just type cal.\n");
     return(1);
   }
   else
    if(argc != 1 && argc != 3)
    {
      fprintf(stderr, "\nCal requires 0 or 2 arguments\n");
      fprintf(stdout, "For help type  cal -?\n");
      return(1);
    }
    if(argc == 1)
    {
      date = TimeDate();	 /* Initialize and fill all fields.   */
      theMonth = date->td_mon;	 /* Access the month and year fields. */
      theYear = date->td_year;
    }
    else
     if(argc == 3)
     {
       theMonth = atoi(argv[1]);
       theYear  = atoi(argv[2]);
     }

     PrintCalendar(theMonth, theYear);
  
   return(0);
}
       

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -