ywtl.net
当前位置:首页>>关于C语言编程序实现如下功能:输入任意一个日期的年,...的资料>>

C语言编程序实现如下功能:输入任意一个日期的年,...

#includeint Month[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};int print_month[7][8];bool leap_year(int year){ return year%4==0&&year%100!=0||year%400==0;}int get_days(int year,int month,int day){//返回从公元1年1月1日到该日期的...

#include int days[]={31,28,31,30,31,30,31,31,30,31,30,31}; int main() { int year , mon , day , num; printf("input yyyy/mm/dd:"); scanf("%d/%d/%d" , &year , &mon , &day ); //请确保输入的数据是有效的日期,不然出错 //根据年份确定...

简单,用蔡勒公式即可: #include int main () { int y, m, d, c, w; printf ("输入年 月 日(空格间隔):"); scanf ("%d %d %d", &y, &m, &d); if (m ==1 || m == 2) { //判断月份是否为1或2 y--; m += 12; } c = y / 100; y = y - c * 100; w...

#include void main () { int y,m,d,c,s,w; printf("请输入8位年月日,以空格隔开:"); scanf("%d%d%d",&y,&m,&d); if (m==1) c=d; else if (m==2) c=31+d; else if (m==3) c=31+28+d; else if (m==4) c=31+28+31+d; else if (m==5) c=31+28+31+3...

程序的核心是判断是否闰年,以及判断每个月的天数,完整程序如下: int mdays(int y,int m){ if (m==2) return (y%4==0 && (y%100==0 || y%400==0))?29:28; else if (m==4 || m==6 || m==9 || m==11) return 30; else return 31; } main(){ int ...

//#include "stdafx.h"//vc++6.0加上这一行. #include "stdio.h" void yesterday(int *y,int *m,int *d){ int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; if(--*d==0){ if(--*m==2) *d=28+(*y%400==0 || *y%4==0 && *y%100!=0); else if...

//输入年月日,再输入天数,求这些天之后的日期是多少 #include int main() { int s[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31, 0,31,29,31,30,31,30,31,31,30,31,30,31,}; int year=0; int month=0; int day=0; int n,i,daytemp; int flag=...

#include void main() { int year=2013,month,day,c=0,m; int daysOfMonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; char str[7][10]={"星期天","星期一","星期二","星期三","星期四","星期五","星期六"}; printf("\n从键盘输入开始日期,月 ...

#include int main() { int day,mn,yr,i,days=0,s,k; int mont[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; char wek[][9]={ {'S','u','n','d','a','y'}, {'M','o','n','d','a','y'}, {'T','u','e','s','d','a','y'}, {'W','e','d','n','s','...

//#include "stdafx.h"//vc++6.0加上这一行. #include "stdio.h" void main(void){ char x[12]={3,6,6,2,4,0,2,5,1,3,6,1},md[12]={31,28,31,30,31,30,31,31,30,31,30,31}; char w[][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","...

网站首页 | 网站地图
All rights reserved Powered by www.ywtl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com