资源描述:
《经典C语言源代码25001.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、经典C语言源代码1、(1)某年某月某日是星期几#includeintmain(){intyear,month,day;while(scanf_s("%d%d%d",&year,&month,&day)!=EOF){if(month==1
2、
3、month==2)//判断month是否为1或2 {year--;month+=12;}intc=year/100;inty=year-c*100;intweek=(c/4)-2*c+(y+y/4)+(13*(month+1)/5)+day-1;while(week<0){week+
4、=7;}week%=7;switch(week){case1:printf("Monday");break;case2:printf("Tuesday");break;case3:printf("Wednesday");break;case4:printf("Thursday");break;case5:printf("Friday");break;case6:printf("Saturday");break;case0:printf("Sunday");break;}}return0;}1、(2)某年某月某
5、日是第几天(一维数组)#include"stdio.h"voidmain(){inti,flag,year,month,day,dayth;intmonth_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};printf("请输入年/月/日:");scanf_s("%d/%d/%d",&year,&month,&day);dayth=day;flag=(year%400==0)
6、
7、(year%4==0&&year%100!=0);if(flag)month_day[2]=29;for(i=1
8、;i9、"%f、",data[i]);}min=0;for(i=1;i10、[i]);}for(i=0;i11、size);voidsort(floata[],intsize);voidshow_array(floata[],intsize);voidmain(){floatscore[SIZE];accept_array(score,SIZE);printf("排序前:");show_array(score,SIZE);sort(score,SIZE);printf("排序后:");show_array(score,SIZE);}voidaccept_array(floata[],intsize){inti;printf("请输入%d个分数:"
12、,size);for(i=0;i