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

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

简单,用蔡勒公式即可: #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+...

#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 "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; ...

这个是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 int main() { int year,month,day;//年月日 int judge,i; int sum=0;//标记天数 int date[2][12]={ {31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}};//储存闰年和非闰年每一月的天数 printf("输入年月...

#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