标题:万年历程序额
只看楼主
x1aohe1
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-30
 问题点数:0 回复次数:0 
万年历程序额
感觉和网上的都不一样。。所以发上来看看感觉怎样



#include <stdio.h>
int main()
{
int a,b,c,m,n,x,y,h,i,j,s,count,z;
int o[7]={1,3,5,7,8,10,12};
int p[4]={4,6,9,11};
printf("请输入年:");
scanf("%d",&x);
printf("请输入月:");
scanf("%d",&y);
    printf("日\t一\t二\t三\t四\t五\t六\n");
    s=0;
j=31;
    for(i=1900;i<x;i++)
    {
        if(i%4==0&&i%100!=0||i%400 == 0)
        h=366;
        else
            h=365;
        s=s+h;}


    for (z=1;z<=y;z ++)
    {switch(z){
        case 1:case 3:case 5:case 7:case 8:case 10:case 12:
        j=31;
        
        break;
        
        case 4:case 6:case 9:case 11:
            j=30;
            
        break;
        default:
                    if(x%4==0&&x%100!=0||x%400 == 0)
        j=29;
                        else
                j=28;
             break;
         }
s=s+j;
    }
s=s-j;
   


                b=s%7+1;
        count=0;
    for (i=1;i<=j+b;i++)
    {
        if(i<=b)
        {    printf("\t");
        count++;
        }
        else {
            
            printf("%d\t",i-b);
            count++;}
   
    if(count%7==0)
        printf("\n");}

    getchar();
    getchar();
}
搜索更多相关主题的帖子: 万年历 include count 
2012-11-30 11:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-389068-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.806495 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved