ywtl.net
当前位置:首页>>关于C语言编程题:给出元旦是星期几,求某个日期是该年...的资料>>

C语言编程题:给出元旦是星期几,求某个日期是该年...

代码如下,请查看: #include //判断是否为闰年 int IsLeepYear(int year) { if( ((0 == year%4)&&(0 != year%100)) ||(0 == year %400) ) return 1; else return 0; } //计算为星期几的函数 void CountWeekday(int firstWeekDay, int year, int...

简单,用蔡勒公式即可: #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 int main() { int sum=0; int i; int month[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int yeal,mon,day; printf("输入日期,格式为‘yeal,month,day’,如2012,11,23\n"); scanf("%d,%d,%d",&yeal,&mon,&day); if((yeal%400==0)||(...

#include int main(void) { int month,year,day,sum,i=0; printf("输入年月日:\n"); scanf("%d %d %d",&year,&month,&day); switch(month) { case 12: i=i+30; case 11: i=i+31; case 10: i=i+30; case 9: i=i+31; case 8: i=i+31; case 7: i=i+...

#include "stdio.h"int main(void){ int y,m,d; char *w[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; while(1){ printf("Please enter y, m, d(int >0)...\n"); if(scanf("%d%d%d",&y,&m,&d) && y>0) break; ...

#include "stdio.h"int main(void){ char md[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int y,m; while(1){ printf("Please input year & month(' ' separated)...\n"); if(scanf("%d%d",&y,&m) && y>0 && m>0 && m

这个是1984年1月1日是星期日的,你先看看,我再帮你改,最好自己能看懂 #include void main() { int year,month,day; int tempmonth,yearday; int week,weekday; unsigned int sum=0; int tag=0; printf("输入年、月、日:\n"); scanf("%d %d %d"...

//希望我的回答对你的学习有帮助#include struct ymd { int Y,M,D; }; const short MonthDay[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int YMD_2_JD(int Y, int M, int D){ const short MonthDay[]={0,31,28,31,30,31,30,31,31,30,31,30,31}...

#include //返回指定年月日是对应年度的第几天 int getDays(int month,int day); int isRunnian(int year); int main(int argc,char* argv[]) { int year=0; int month=0; int day=0; printf("请输入年月日格式示例20140101\n"); scanf("%4d%2d%...

#includestruct y_m_d{ int year; int month; int day;};int days(struct y_m_d date){ int sum=date.day; int a[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31}; int i; for(i=1; i2&&((date.year%4==0&&date.year%100!=0)||date.year%400==0))...

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