回覆列表
  • 1 # 讓跑步更有力量

    #include<stdio.h>

    int count(int a[12],int b[12],int year,int mounth,int day)//定義一個count函式

    {

    int i,sum=0;

    if(year%4==0&&year%100!=0||year%400==0)//判斷是否是閏年,若是則

    for(i=0;i<mounth;i++)

    {

    sum+=a[i];

    }

    else

    for(i=0;i<mounth;i++)

    {

    sum+=b[i];

    }

    sum+=day;

    return(sum);

    }

    void main()

    {

    int year,mounth,day,m;

    int

    a[12]={31,29,31,30,31,30,31,31,30,31,30,31},

    b[12]={31,28,31,30,31,30,31,31,30,31,30,31};

    //a陣列是定義的閏年每月份的天數,b陣列是定義的非閏年每月份的天數

    printf("請輸入年year,月mounth,日day\n");

    scanf("%d,%d,%d",&year,&mounth,&day);

    m=count(a,b,year,mounth,day);

    printf("%d\n",m);

    }

  • 中秋節和大豐收的關聯?
  • CAD中怎樣轉換平面座標,比如說我的圖紙在規劃圖上的座標,我要搬到結構圖使用,怎麼轉換,軸線是已知的?