| 222.240.106.* |
1楼 |
|
|
| 222.240.106.* |
2楼 |
|
|
|
4楼 其中a为年c为该日期在本年中的天数,d取整数,当d/7余数0时是星期天,余数1时是星期一依此类推。 #include <stdio.h> int m_day(int year,int month)/*此函数是给定年,月,计算此月有多少天.*/ { if ((year%4==0 &&year%100!=0) ¦¦ (year%400==0)) switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return 29; } else switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return 28; } } int main() { int year,month; int i,days=0,d,day=0; printf("Enter the year and month:\n"); scanf("%d%d",&year,&month); for (i=1;i<month;i++) days+=m_day(year,i); d=year-1+(year-1)/4-(year-1)/100+(year-1)/400+days+1; printf("%d-%d\n",year,month); printf(" Sun Mon Tue Wed Thu Fri Sat\n"); for (i=0;i<d%7;i++) printf(" "); for (i=1;i<=7-d%7;i++) { day++; printf("%5d",day); } printf("\n"); while(1) { for (i=1;i<=7;i++) { day++; if (day>m_day(year,month)) {getch();return 0;} printf("%5d",day); } printf("\n"); } } |
|
|
|
| 222.240.107.* |
6楼 真是救了我一命哦 |
|
|
| 222.88.155.* |
7楼 |
|
|
| 220.175.108.* |
8楼 |
|
|
| 61.150.95.* |
9楼 我们要也考 无聊 |
|
|
| 61.150.95.* |
10楼 |
|
|
| 222.69.31.* |
11楼 {int k,y,m,min,max,temp,w,z=2; int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; long total; char b[8]; loop:printf("\n\nPlease input year month:"); scanf("%d%d",&y,&m); if (y%400==0||(y%100!=0&&y%4==0)){a[1]=29;strcpy(b,"Run Nian");} else {a[1]=28;strcpy(b,"PingNian");} if (y>=1980){min=1980;max=y;k=1;} else{min=y;max=1980;k=-1;} total=0; for (temp=min;temp<max;temp++) {if (temp==0)continue; if (temp%400==0||(temp%4==0&&temp%100!=0)) total=total+366; else total=total+365; } for (temp=0;temp<m-1;temp++) total=total+k*a[temp]; if (k==1) w=(total+z)%7; if (k==-1) w=(7-(total-z)%7)%7; printf("\n%d,%d %s\n",y,m,b); printf("\nSun Mon Tue Wed Tur Fri Sat\n"); for (temp=0;temp<w;temp++)printf(" "); for (temp=1;temp<=a[m-1];temp++) {if ((temp-1+w)%7==0) printf("\n"); printf(" %2d ",temp); } goto loop; } |
|
|
| 211.65.83.* |
12楼 |
|
|
| 210.22.200.* |
13楼 |
|
|
| 210.22.200.* |
14楼 |
|
|
| 210.22.200.* |
15楼 |
|
|
| 202.206.159.* |
16楼 |
|
|
| 202.100.24.* |
17楼 |
|
|
| 202.100.24.* |
18楼 |
|
|
| 60.190.70.* |
19楼 |
|
|
|
20楼 #include<bios.h> #include<stdlib.h> #include<conio.h> #define LEFT 0x4b00 #define RIGHT 0x4d00 #define ESC 0x011b #define ENTER 0x1c0d char *a[4]={"left","right","up","down"}; int num=3000,key,year=2006; int i,j,first=3,w=30; char *month[12]={"Junuary","February","March","April","May","June","July","August","September","October","November","December"}; int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int fd[12]={0}; int getkey() {char lowbyte; int press; while(bioskey(1)==0) press=bioskey(0); lowbyte=press&0xff; press=press&0xff00+toupper(lowbyte); return(press); } void sch() {window(22,24,30,24); textbackground(GREEN); clrscr(); textcolor(15); cprintf("\n Search");} void sch_0() {window(22,24,30,24); textbackground(GREEN); clrscr(); textcolor(128); cprintf("\n Search ");} void backk() {window(33,24,42,24); textbackground(GREEN); clrscr(); textcolor(15); cprintf("\n Month1-4");} void backk_0() {window(33,24,42,24); textbackground(GREEN); clrscr(); textcolor(128); cprintf("\n Month1-4");} void left() { window(45,24,54,24); textbackground(GREEN); clrscr(); textcolor(15); cprintf("\n Month5-8");} void left_0() { window(45,24,54,24); textbackground(GREEN); clrscr(); textcolor(128); cprintf("\n Month5-8");} void right() {window(57,24,67,24); textbackground(GREEN); clrscr(); textcolor(15); cprintf("\n Month9-12");} void right_0() {window(57,24,67,24); textbackground(GREEN); clrscr(); textcolor(128); cprintf("\n Month9-12");} void iexit() {window(70,24,77,24); textbackground(GREEN); clrscr(); textcolor(15); cprintf("\n Exit");} void iexit_0() {window(70,24,77,24); textbackground(GREEN); clrscr(); textcolor(128); cprintf("\n Exit");} void jiance(int n) {switch(n) {case 0:sch_0();left();right();iexit();backk();break; case 1:backk_0();left();right();iexit();sch();break; case 2:left_0();right();iexit();sch();backk();break; case 3:right_0();left();iexit();sch();backk();break; case 4:iexit_0();left();right();sch();backk();break; default:exit(0); } } void quzhi() {window(8,24,20,24); textbackground(15); clrscr(); textcolor(RED); cscanf("%d",&year); } void month1_4() { for(i=0;i<2;i++) {window(2+i*w,3,29+w*i,11); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s\n",month[i]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i]-1)+1,3); for(j=1;j<=mon[i];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i])%7; if(first==0)first=7;*/ } for(i=2;i<4;i++) {window(2+(i-2)*w,13,29+w*(i-2),21); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s\n",month[i]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i]-1)+1,3); for(j=1;j<=mon[i];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i])%7; if(first==0)first=7;*/ |
|
|
|
|
21楼 } void month5_8() {for(i=0;i<2;i++) {window(2+i*w,3,29+w*i,11); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s\n",month[i+4]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i+4]-1)+1,3); for(j=1;j<=mon[i+4];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i+4])%7; if(first==0)first=7;*/ } for(i=2;i<4;i++) {window(2+(i-2)*w,13,29+w*(i-2),21); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s",month[i+4]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i+4]-1)+1,3); for(j=1;j<=mon[i+4];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i+4])%7; if(first==0)first=7;*/ } } void month9_12() {for(i=0;i<2;i++) {window(2+i*w,3,29+w*i,11); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s\n",month[i+8]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i+8]-1)+1,3); for(j=1;j<=mon[i+8];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i+8])%7; if(first==0)first=7;*/ } for(i=2;i<4;i++) {window(2+(i-2)*w,13,29+w*(i-2),21); textbackground(5); clrscr(); textcolor(GREEN); cprintf(" %s",month[i+8]); gotoxy(1,2);cprintf(" Mon Tue Wed Thu Fri Sat Sun"); gotoxy(4*(fd[i+8]-1)+1,3); for(j=1;j<=mon[i+8];j++) {cprintf("%3d ",j); /*if((first+j-1)%7==0)putchar('\n');*/ } /*first=(first+mon[i+8])%7; if(first==0)first=7;*/ } } void calendar(int year) {int x,cha; long day=0; window(1,2,80,22); textbackground(YELLOW); clrscr(); if(year<2007) {for(x=year;x<2007;x++) {if((x%4==0&&x%100!=0)||x%400==0) day+=366; else day+=365;} cha=day%7; first=(7+1-cha)%7; if(first==0)first=7; } if(year==2007)first=1; if(year>2007) {for(x=2007;x<year;x++) {if((x%4==0&&x%100!=0)||x%400==0) day+=366; else day+=365;} cha=day%7; first=(1+cha)%7; if(first==0)first=7; } if((year%4==0&&year%100!=0)||year%400==0) mon[1]=29; else mon[1]=28; fd[0]=first; for(j=1;j<12;j++) {fd[j]=(fd[j-1]+mon[j-1])%7; if(fd[j]==0)fd[j]=7;} month1_4();} void jiance2(int n) {void nian(int year); switch(n) {case 0:getch( );quzhi();calendar(year);nian(year);break; case 1:month1_4();break; case 2:month5_8();break; case 3:month9_12();break; case 4:exit(0);break; default:exit(0);} } void ping() {clrscr(); window(1,1,80,1); textbackground(RED); clrscr(); gotoxy(6,1); textcolor(GREEN); cprintf("FILE Record Link Help"); window(2,1,4,1); textbackground(0); clrscr(); window(1,2,80,22); textbackground(YELLOW); clrscr(); window(1,23,80,25); textbackground(BLUE); clrscr(); window(8,24,20,24); textbackground(15); clrscr(); sch_0(); left(); right(); iexit(); backk(); calendar(2006); } void copyright() {clrscr(); window(15,5,65,15); textbackground(RED); clrscr(); textcolor(GREEN); cprintf("\n Calendar\n"); gotoxy(1,4); cprintf(" Copyright©XiaoHuTuShen Software studio\n"); gotoxy(1,6); cprintf(" >September 19th,2006"); gotoxy(1,8); cprintf(" Shandong University South New Disrict 13#418"); gotoxy(1,10); cprintf(" ReGong Class 5,Grade 2005"); } void nian(int year) {window(62,5,78,5); textbackground(RED); clrscr(); textcolor(GREEN); cprintf("\n Calendar"); window(64,7,75,11); textbackground(15); clrscr(); textcolor(1); cprintf("\n Year"); gotoxy(3,4); cprintf("%6d",year); window(62,13,78,20); textbackground(8); clrscr(); textcolor(9); cprintf("\n Copyright©"); gotoxy(1,4); cprintf(" Xiao HuTu Shen"); gotoxy(1,6); cprintf(" sg_yyg@163.com"); return; } main() {clrscr(); window(1,1,80,1); textbackground(RED); clrscr(); gotoxy(6,1); textcolor(GREEN); cprintf("FILE Record Link Help"); window(2,1,4,1); textbackground(0); clrscr(); window(1,2,80,22); textbackground(YELLOW); clrscr(); window(1,23,80,25); textbackground(BLUE); clrscr(); window(8,24,20,24); textbackground(15); clrscr(); copyright(); sch_0(); backk(); left(); right(); iexit(); getch(); ping(); calendar(2006); nian(2006); while(key!=28) {if(bioskey(1))key=bioskey(0); switch(key) {case LEFT:num--;jiance(num%5);key=0;break; case RIGHT:num++;jiance(num%5);key=0;break; case ENTER:jiance2(num%5);key=0;break; case ESC:exit(0); default:key=0;break;} } } |
|
|
|
|
22楼 int pdr(int y) { return ((y%4==0&&y%100!=0)||y%400==0); } long pynum(int y) { int i,r=0; long n; for(i=1;i<y;i++) if(pdr(i)) r++; n=(y-1)*365+r; return n; } int tynum(int m,int y) { int d=0; switch(m-1) { case 11:d+=30; case 10:d+=31; case 9:d+=30; case 8:d+=31; case 7:d+=31; case 6:d+=30; case 5:d+=31; case 4:d+=30; case 3:d+=31; case 2:if(pdr(y)) d+=29; else d+=28; case 1:d+=31; case 0:; } return d; } int tmn(int m,int y) { int n; switch(m) { case 1:n=31;break; case 2:if(pdr(y)) n=29; else n=28;break; case 3:n=31;break; case 4:n=30;break; case 5:n=31;break; case 6:n=30;break; case 7:n=31;break; case 8:n=31;break; case 9:n=30;break; case 10:n=31;break; case 11:n=30;break; case 12:n=31;break; } return n; } int w(long n) { int t; t=n%7; return t; } main() { long n; int y,p,i,m,q,s=0; printf("Please input the year--month:\n"); scanf("%d--%d",&y,&m); n=pynum(y)+tynum(m,y); p=w(n); q=tmn(m,y); printf(" SUN MON TUE WED THU FRI SAT\n"); for(i=0;i<(p<5? (p+2):(p-5));i++) { printf("\t"); s++; } for(i=1;i<=q;i++) { if(s==7) { printf("\n"); s=0; } printf("%8d",i); s++; } printf("\n"); } |
|
|
|
|
23楼 ompiling... zhang.cpp D:\Documents and Settings\xh\桌面\常用软件\zhang.cpp(45) : error C2065: 'getch' : undeclared identifier Error executing cl.exe. zhang.obj - 1 error(s), 0 warning(s) 哪里 的问题啊/?我用的是VC++软件 |
|
|
| 202.196.73.* |
24楼 int runn(int y) { if(y%4) return 0; if(y%100==0&&y%400!=0) return 0; return 1; } int addy(int y) { int d; if(y==1) d=1; else{ if(runn(y-1)) d=(366+addy(y-1))%7; else d=(365+addy(y-1))%7; } return d; } int pt() { printf("%6s%6s%6s%6s%6s%6s%6s\n","Sun","Mon","Tue", "Wen","Thu","Fri","Sat"); return 0; } int pd(int y,int k,int n) { int i,j; j=addy(y)+k; for(i=0;i<6*(j%7);i++) printf(" "); for(i=1;i<=n;i++){ printf("%6d",i); if((i+j)%7==0) printf("\n"); } printf("\n"); return 0; } int pm(int m) { printf("********************%d**********************\n",m); return 0; } int main() { int y,m,d,n,k=0,l,i=1; n=addy(y); printf("请输入一个日期:"); scanf("%d%d%d",&y,&m,&d); while(i<=12){ if(i==2){ if(runn(y)){ n=29; k=k+29; } else{ k=k+28; n=28; } } if(i==4||i==6||i==9||i==11){ n=30; k=k+30; } if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){ n=31; k=k+31; } pm(i); pt(); pd(y,k-n,n); i++; } return 0; } 希望大家多多修改,以 得到更好的程序阿394637289@163.com |
|
|
| 221.205.45.* |
25楼 |
|
|
| 61.186.109.* |
26楼 int m_day(int year,int month) { if ((year%4==0 &&year%100!=0) ||(year%400==0)) switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return 29; } else switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return 28; } } int main() { int year,month; int i,days=0,d,day=0; printf("Enter the year:\n"); scanf("%d",&year); for(month=1;month<13;month++) { day=0; days=0; for (i=1;i<month;i++) days+=m_day(year,i); d=year-1+(year-1)/4-(year-1)/100+(year-1)/400+days+1; printf("%d-%d\n",year,month); printf(" Sun Mon Tue Wed Thu Fri Sat\n"); for (i=0;i<d%7;i++) printf(" "); for (i=1;i<=7-d%7;i++) { day++; printf("%5d",day); } printf("\n"); while(day<m_day(year,month)) {for (i=1;i<=7;i++) {if(day==m_day(year,month)) break; day++; printf("%5d",day); } printf("\n"); } printf("\n"); } } |
|
|
| 60.161.79.* |
27楼 |
|
|
| 124.114.170.* |
28楼 |
|
|
| 58.50.168.* |
29楼 日 都是高手啊~~ 我也是才刚刚接触的这个东西~~~ 今天深深被你们给打击了``` 有没有愿意教我一哈 QQ:236763198 |
|
|
| 59.60.131.* |
31楼 |
|
|
| 218.56.156.* |
32楼 创想万年历 一个用MFC,10秒钟插起来的小程序。 |
|
|