nynw.net
当前位置:首页 >> 编写一个C语言程序,输入一个年月日,输出这个日期... >>

编写一个C语言程序,输入一个年月日,输出这个日期...

#include int main(){ int day = 0; int y = 0; int m = 1; int d = 0; scanf("%d-%d-%d", &y, &m, &d); switch(m-1) //故意没有在case里加break { case 11: day += 30; case 10: day += 31; case 9: day += 30; case 8: day += 31; case 7: day...

#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 ); //请确保输入的数据是有效的日期,不然出错 //根据年份确定...

请分别输入年月日三个数值,计算出这是这一年的第几天?(提示:要考虑闰年和2月的情况)*/#include void main(){int year=0,month=0,day=0,i=0,sum=0;while(1){printf("请输入年份:"); scanf("%d",&year); printf("请输入月份:"); scanf("%d"...

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

#includevoid main(){int nian,yue,ri,a,b;printf("输入年月日\n");scanf("%d%d%d",&nian,&yue,&ri);switch(yue){case 1:b=0;break;case 2:b=31;break;case 3:b=59;break;case 4:b=90;break;case 5:b=120;break;case 6:b=151;break;case 7:b=181...

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

x=f(×);不太确定你出现了什么错误。

//输入年月日,再输入天数,求这些天之后的日期是多少 #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 #include char* month_str[]={"January","February","March","April","May","June","July","August","September","October","November","December"}; char* week[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Sat...

#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)||(...

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