switch (m)
{
case 1: s=0+d;break;
case 2: s=31+d;break;
case 3: s=31+d+i+28;break;
case 4: s=31+i+28+31+d;break;
case 5: s=31+i+28+31+30+d;break;
case 6: s=31+i+28+31+30+31+d;break;
case 7: s=31+i+28+31+30+31+30+d;break;
case 8: s=31+i+28+31+30+31+30+31+d;break;
case 9: s=31+i+28+31+30+31+30+31+31+d;break;
case 10: s=31+i+28+31+30+31+30+31+31+30+d;break;
case 11: s=31+i+28+31+30+31+30+31+31+30+31+d;break;
case 12: s=31+i+28+31+30+31+30+31+31+30+31+30+d;break;
default: printf("Input Error!!!"); goto loop;
}
这一段建议采用函数调用形式,
给定一个参数,然后返回相应的值
{
case 1: s=0+d;break;
case 2: s=31+d;break;
case 3: s=31+d+i+28;break;
case 4: s=31+i+28+31+d;break;
case 5: s=31+i+28+31+30+d;break;
case 6: s=31+i+28+31+30+31+d;break;
case 7: s=31+i+28+31+30+31+30+d;break;
case 8: s=31+i+28+31+30+31+30+31+d;break;
case 9: s=31+i+28+31+30+31+30+31+31+d;break;
case 10: s=31+i+28+31+30+31+30+31+31+30+d;break;
case 11: s=31+i+28+31+30+31+30+31+31+30+31+d;break;
case 12: s=31+i+28+31+30+31+30+31+31+30+31+30+d;break;
default: printf("Input Error!!!"); goto loop;
}
这一段建议采用函数调用形式,
给定一个参数,然后返回相应的值