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("Input the year, the month and the day:\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; c...

#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" #include "conio.h" main() { int day,month,year,sum,leap; printf("\nplease input year,month,day\n"); scanf("%d,%d,%d",&year,&month,&day); switch(month) /*先计算某月以前月份的总天数*/ { case 1:sum=0;break; case...

#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%...

#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日到该日期的...

我大概给个思路,代码是现写的 没调试先定义每个月的天数,2月按28天算输入年月日后,根据年判断是否闰年(闰年加1天),再从1月加到当月的前一月,再加上日期就可以了#include int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};main(){i...

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