回覆列表
  • 1 # 發發發狗

    #include "stdio.h"

    void main()

    {struct time

    {

    int hour;

    int min;

    int sec;

    };

    {struct time x={10,20,30};

    int m;

    int s;

    printf("請輸入要加的分秒值");

    scanf("%d,%d",&m,&s);

    if(x.min+m<60)

    x.min+=m;

    else

    {x.hour=x.hour+1;

    x.min=(x.min+m)%60;

    }

    if(x.sec+s<60)

    x.sec+=s;

    else

    {x.min=x.min+1;

    x.sec=(x.sec+s)%60;

    }

    printf("增加後時間\n");

    printf("hour:%d\n",x.hour);

    printf("min:%d\n",x.min);

    printf("sec:%d\n",x.sec);

    getch();

    }

    }

  • 中秋節和大豐收的關聯?
  • 怎麼做老醋花生?