c语音程序设计的编程问题

img


int main() {
       
    int h1,h2,m1,m2,s1,s2;
    int temp1=0,temp2=0;
    scanf("%d:%d:%d %d:%d:%d",&h1,&m1,&s1,&h2,&m2,&s2);
    temp1 = h1*60*60+m1*60+s1;
    temp2 = h2*60*60+m2*60+s2;
    temp1 = temp2-temp1;
    h1 = temp1/60/60;
    m1 = (temp1-h1*60*60)/60;
    s1 = temp1-h1*60*60-m1*60;
    if(h1>2)
        printf("时间间隔=%02d:%02d:%02d  你能享受公交优惠1元\n",h1,m1,s1);
    else
        printf("时间间隔=%02d:%02d:%02d  对不起,你不能享受公交优惠\n",h1,m1,s1);
    
   
    return 0;
}
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^