请大佬们看看为什么编译错位

P5707 【深基2.例12】上学迟到

SQH2004 @ 2024-09-28 20:56:09

#include<stdio.h>
int main(){
    int s,v;
    scanf("%d %d",&s,&v);
    int t=s/v;
    if(s%v=0){
        int shi=(t+10)/60;
        int fen=(t+10)%60;
        if(t+10<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
              else printf("0%d:0%d",8-shi,60-fen);}
            else if(fen<=50){
                if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen)
                else printf("0%d:%d",32-shi,60-fen)
                }
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen)
            else printf("0%d:0%d",32-shi,60-fen)}
    }
    else {
        int shi=(t+11)/60;
        int fen=(t+11)%60;
        if(t+11<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
            else printf("0%d:0%d",8-shi,60-fen);}
        else if(fen<=50){
            if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen)
            else printf("0%d:%d",32-shi,60-fen)}
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen)
            else printf("0%d:0%d",32-shi,60-fen)}
    }
    return 0;

}

by litangzheng @ 2024-09-28 21:10:27

@SQH2004 第32行与第36行没有分号。


by is_laofang @ 2024-09-28 21:12:13

《编 译 错 位》


by BNCDBD @ 2024-09-28 21:12:49

@SQH2004

#include<stdio.h>
int main(){
    int s,v;
    scanf("%d %d",&s,&v);
    int t=s/v;
    if(s%v==0){
        int shi=(t+10)/60;
        int fen=(t+10)%60;
        if(t+10<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
              else printf("0%d:0%d",8-shi,60-fen);}
            else if(fen<=50){
                if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen);
                else printf("0%d:%d",32-shi,60-fen);
                }
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen);
            else printf("0%d:0%d",32-shi,60-fen);}
    }
    else {
        int shi=(t+11)/60;
        int fen=(t+11)%60;
        if(t+11<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
            else printf("0%d:0%d",8-shi,60-fen);}
        else if(fen<=50){
            if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen);
            else printf("0%d:%d",32-shi,60-fen);}
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen);
            else printf("0%d:0%d",32-shi,60-fen);}
    }
    return 0;

}

各种分号没写,第6行=改成==


by SQH2004 @ 2024-10-01 19:16:13

@litangzheng 好嘞好嘞,谢谢佬


by SQH2004 @ 2024-10-01 19:17:06

明白啦,谢谢佬


by SQH2004 @ 2024-10-01 19:18:16

@is_laofang 太着急啦,不小心打错了


by SQH2004 @ 2024-10-01 19:18:59

@BNCDBD 好嘞,明白啦,谢谢佬


by SQH2004 @ 2024-10-01 19:59:45

为什么还是不对啊啊啊

#include<stdio.h>
#include<cstdio>
int main(){
    int s,v;
    scanf("%d %d",&s,&v);
    int t=s/v;
    if(s%v==0){   
        int shi=(t+10)/60;
        int fen=(t+10)%60;
        if(t+10<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
            else printf("0%d:0%d",8-shi,60-fen);}
        else if(fen<=50){
            if(32-shi>=10)
              printf("%d:%d",32-shi,60-fen);
            else printf("0%d:%d",32-shi,60-fen);}
        else if(fen>50){
            if(32-shi>=10)
              printf("%d:0%d",32-shi,60-fen);
            else printf("0%d:0%d",32-shi,60-fen);}
    }
    else {
        int shi=(t+11)/60;
        int fen=(t+11)%60;
        if(t+11<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
            else printf("0%d:0%d",8-shi,60-fen);}
        else if(fen<=50){
            if(32-shi>=10)
              printf("%d:%d",32-shi,60-fen);
            else printf("0%d:%d",32-shi,60-fen);}
        else if(fen>50){
            if(32-shi>=10)
              printf("%d:0%d",32-shi,60-fen);
            else printf("0%d:0%d",32-shi,60-fen);}
    }
    return 0;

}

by BNCDBD @ 2024-10-02 09:09:30

@SQH2004 那可能是逻辑不对

我只改了编译错误


by SQH2004 @ 2024-10-02 09:20:24

@BNCDBD 呜呜呜废了


| 下一页