Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 根据复活节计算时间事件_C_Shell_Unix_Calendar - Fatal编程技术网

C 根据复活节计算时间事件

C 根据复活节计算时间事件,c,shell,unix,calendar,C,Shell,Unix,Calendar,假设约翰的周年纪念日正好在复活节。约翰尼的周年纪念日总是在复活节后的一周。艾伦的周年纪念日是五旬节前一周(复活节后42天) 如何使用shell脚本计算他们生日的日期(数字和日期名称)和月份。在未来的岁月里 我知道,我可以用ncal-e“year”计算复活节。 在C语言中,我是这样做的: typedef struct { int day; int month; int year; } Date; 然后我计算复活节(用高斯算法)。并将日、月、年返回到五旬节函数,该函数取日+49,递减日

假设约翰的周年纪念日正好在复活节。约翰尼的周年纪念日总是在复活节后的一周。艾伦的周年纪念日是五旬节前一周(复活节后42天)

如何使用shell脚本计算他们生日的日期(数字和日期名称)和月份。在未来的岁月里

我知道,我可以用
ncal-e“year”
计算复活节。 在C语言中,我是这样做的:

typedef struct {
  int day;
  int month;
  int year;
} Date;
然后我计算复活节(用高斯算法)。并将日、月、年返回到五旬节函数,该函数取日+49,递减日,递增月

因此:

  • 在shell中,如何转换“一月”的
    ncal-e
    输出 2019年1月至2019年1月,仅壳牌公司
  • 如果我有这个怎么办 你能开始为上面的故事制定规则吗。(对于 (生日)
  • 复活节日期(整数Y) { 日期; int C=地板(Y/100); int N=Y-19*楼层(Y/19); int K=楼层((C-17)/25); INTI=C-楼层(C/4)-楼层((C-K)/3)+19*N+15; I=I-30*楼层((I/30)); I=I-楼层(I/28)*(1-楼层(I/28)*楼层(29/(I+1))*楼层((21-N)/11)); int J=Y+楼层(Y/4)+I+2-C+楼层(C/4); J=J-7*层(J/7); int L=I-J; int M=3+层((L+40)/44); int D=L+28-31*层(M/4); 日期d=d; 日期m=m; 日期y=y; 返回日期; }
    只需编写一个调用
    ncal-e

    easter() {
        local year=${1:-$(date "+%Y")}   # use this year if no arg provided
        local easter=$(ncal -e "$year")  # month day year
        date -d "$easter" "+%F"          # YYYY-mm-dd
    }
    
    然后


    如果选择,请使用不同的日期格式。

    只需编写一个调用
    ncal-e

    easter() {
        local year=${1:-$(date "+%Y")}   # use this year if no arg provided
        local easter=$(ncal -e "$year")  # month day year
        date -d "$easter" "+%F"          # YYYY-mm-dd
    }
    
    然后


    如果选择,请使用不同的日期格式。

    当所有变量和常量都是整数时,为什么需要在
    easter
    中调用所有这些
    floor
    ?这只是一个简单的C示例。因此,不是100%正常(尽管它可以工作)。当所有变量和常量都是整数时,为什么需要在
    easter
    中调用所有这些
    floor
    ?这只是一个简单的C示例。因此不是100%正常(尽管它可以工作)。