# include <math.h>
# include <stdbool.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <time.h>
# include "calpak.h"
/******************************************************************************/
char ch_cap ( char ch )
/******************************************************************************/
/*
Purpose:
CH_CAP capitalizes a single character.
Discussion:
This routine should be equivalent to the library "toupper" function.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
19 July 1998
Author:
John Burkardt
Input:
char CH, the character to capitalize.
Output:
char CH_CAP, the capitalized character.
*/
{
if ( 97 <= ch && ch <= 122 )
{
ch = ch - 32;
}
return ch;
}
/******************************************************************************/
void ch_cap_test ( )
/******************************************************************************/
/*
Purpose:
CH_CAP_TEST tests CH_CAP.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
19 January 2007
Author:
John Burkardt
*/
{
char c;
printf ( "\n" );
printf ( "CH_CAP_TEST\n" );
printf ( " CH_CAP uppercases a character.\n" );
printf ( "\n" );
printf ( " C CH_CAP(C)\n" );
printf ( "\n" );
c = 'F';
printf ( " %c %c\n", c, ch_cap ( c ) );
c = 'f';
printf ( " %c %c\n", c, ch_cap ( c ) );
c = '1';
printf ( " %c %c\n", c, ch_cap ( c ) );
c = 'b';
printf ( " %c %c\n", c, ch_cap ( c ) );
c = 'B';
printf ( " %c %c\n", c, ch_cap ( c ) );
return;
}
/******************************************************************************/
double datenum_to_jed ( double dn )
/******************************************************************************/
/*
Purpose:
DATENUM_TO_JED converts a MATLAB date number to a JED.
Discussion:
The MATLAB "datenum" function accepts a string defining
a date and returns a MATLAB date number:
dn = datenum ( 'Aug 17 1939' )
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
15 December 2017
Author:
John Burkardt
Input:
double DN, a MATLAB date number.
Output:
double JED, the Julian Ephemeris Date.
*/
{
double jed;
jed = dn + epoch_to_jed_datenum ( );
return jed;
}
/******************************************************************************/
void datenum_to_jed_test ( )
/******************************************************************************/
/*
Purpose:
DATENUM_TO_JED_TEST tests DATENUM_TO_JED.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
15 December 2017
Author:
John Burkardt
*/
{
double date_num;
int i;
double jed1;
double jed3;
double jed_epoch;
printf ( "\n" );
printf ( "DATENUM_TO_JED_TEST\n" );
printf ( " DATENUM_TO_JED: Matlab DATENUM -> JED.\n" );
printf ( "\n" );
printf ( " JED (in) DATENUM JED (out)\n" );
printf ( "\n" );
jed_epoch = epoch_to_jed_datenum ( );
i = 0;
while ( true )
{
i = i + 1;
jed1 = jed_test ( i );
if ( jed1 < 0.0 )
{
break;
}
if ( jed_epoch <= jed1 )
{
date_num = jed_to_datenum ( jed1 );
jed3 = datenum_to_jed ( date_num );
printf ( " %11.2f %11.2f %11.2f\n", jed1, date_num, jed3 );
}
}
return;
}
/******************************************************************************/
void datenum_values ( int *n_data, int *y, int *m, int *d, double *date_num )
/******************************************************************************/
/*
Purpose:
DATENUM_VALUES returns the MATLAB DATENUM for various dates.
Discussion:
The MATLAB datenum function returns a numeric value for a given date,
which is 1 for the (fictitious) date 1 January 0.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
13 December 2015
Author:
John Burkardt
Input:
int *N_DATA. The user sets N_DATA to 0 before the first call.
Output:
int *N_DATA. On each call, the routine increments N_DATA by 1,
and returns the corresponding data; when there is no more data, the
output value of N_DATA will be 0 again.
Output, int *Y, *M, *D, the Common Era date.
double *DATE_NUM, the datenum.
*/
{
# define N_MAX 11
static int d_vec[N_MAX] = {
1,
1,
1,
1,
17,
9,
10,
12,
6,
25,
1 };
static double date_num_vec[N_MAX] = {
1.0,
367.0,
36526.0,
365244.0,
708434.0,
710284.0,
713023.0,
718199.0,
723186.0,
729080.0,
730486.0 };
static int m_vec[N_MAX] = {
1,
1,
1,
1,
8,
9,
3,
5,
1,
2,
1 };
static int y_vec[N_MAX] = {
0,
1,
100,
1000,
1939,
1944,
1952,
1966,
1980,
1996,
2000 };
if ( *n_data < 0 )
{
*n_data = 0;
}
*n_data = *n_data + 1;
if ( N_MAX < *n_data )
{
*n_data = 0;
*y = 0;
*m = 0;
*d = 0;
*date_num = 0;
}
else
{
*y = y_vec[*n_data-1];
*m = m_vec[*n_data-1];
*d = d_vec[*n_data-1];
*date_num = date_num_vec[*n_data-1];
}
return;
# undef N_MAX
}
/******************************************************************************/
void datenum_values_test ( )
/******************************************************************************/
/*
Purpose:
DATENUM_VALUES_TEST tests DATENUM_VALUES.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
13 December 2017
Author:
John Burkardt
*/
{
int d;
double date_num;
int m;
int n_data;
int y;
printf ( "\n" );
printf ( "DATENUM_VALUES_TEST:\n" );
printf ( " DATENUM_VALUES returns values of \n" );
printf ( " the MATLAB datenum for a given Y/M/D date\n" );
printf ( "\n" );
printf ( " Y M D DATENUM\n" );
printf ( "\n" );
n_data = 0;
for ( ; ; )
{
datenum_values ( &n_data, &y, &m, &d, &date_num );
if ( n_data == 0 )
{
break;
}
printf ( " %4d %4d %4d %11.2f\n", y, m, d, date_num );
}
return;
}
/******************************************************************************/
void day_borrow_common ( int *y, int *m, int *d )
/******************************************************************************/
/*
Purpose:
DAY_BORROW_COMMON borrows days from months in a Common date.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
15 December 2017
Author:
John Burkardt
Parameters:
Input/output, int *Y, *M, *D, a year, month, and day
representing a date. On input, D might be negative. On output,
M should have decreased by one month, and D gone up by the
number of days in the month we "cashed in". Y may be affected
if the input value of M was 1.
*/
{
int days;
while ( *d <= 0 )
{
*m = *m - 1;
month_borrow_common ( y, m );
days = month_length_common ( *y, *m );
*d = *d + days;
}
return;
}
/******************************************************************************/
void day_borrow_gregorian ( int *y, int *m, int *d )
/******************************************************************************/
/*
Purpose:
DAY_BORROW_GREGORIAN borrows days from months in a Gregorian date.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
23 March 2010
Author:
John Burkardt
Parameters:
Input/output, int *Y, *M, *D, a year, month, and day
representing a date. On input, D might be negative. On output,
M should have decreased by one month, and D gone up by the
number of days in the month we "cashed in". Y may be affected
if the input value of M was 1.
*/
{
int days;
while
没有合适的资源?快使用搜索试试~ 我知道了~
C 代码 进行各种日历计算.rar
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共6个文件
c:2个
sh:2个
h:2个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 16 浏览量
2022-11-12
20:02:09
上传
评论
收藏 28KB RAR 举报
温馨提示
c++源代码,c源代码,测试可以
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 6 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/f6f011970f0f4dc0b48561c888fd7c9f_xipengbozai.jpg!1)
卷积神经网络
- 粉丝: 342
- 资源: 8460
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)