编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#1723 #992. 鱼塘 Compile Error 0 0 ms 0 K C / 643 B HuangCccccccchang 2023-10-15 16:45:49
显示原始代码
#include <stdio.h>

int main() {
    long a, b, c;
    char str1, str2, str3;
    scanf("%ld%ld%ld", &a, &b, &c)

        if (a % 4 == 0) str1 = "L";
    else if (a % 4 == 1) str1 = "X";
    else if (a % 4 == 2) str1 = "T";
    else if (a % 4 == 3) str1 = "W";

    if (b % 4 == 0)
        str2 = "L";
    else if (b % 4 == 1)
        str2 = "X";
    else if (b % 4 == 2)
        str2 = "T";
    else if (b % 4 == 3)
        str2 = "W";

    if (c % 4 == 0)
        str3 = "L";
    else if (c % 4 == 1)
        str3 = "X";
    else if (c % 4 == 2)
        str3 = "T";
    else if (c % 4 == 3)
        str3 = "W";
    printf("%c%c%c", &str1, &str2, &str3);
    return 0;
}

编译信息

/sandbox/1/a.c:6:32: error: expected ';' after expression
    scanf("%ld%ld%ld",&a,&b,&c)
                               ^
                               ;
/sandbox/1/a.c:9:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str1="L";
            ^~~~
/sandbox/1/a.c:11:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str1="X";
            ^~~~
/sandbox/1/a.c:13:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str1="T";
            ^~~~
/sandbox/1/a.c:15:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str1="W";
            ^~~~
/sandbox/1/a.c:18:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str2="L";
            ^~~~
/sandbox/1/a.c:20:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str2="X";
            ^~~~
/sandbox/1/a.c:22:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str2="T";
            ^~~~
/sandbox/1/a.c:24:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str2="W";
            ^~~~
/sandbox/1/a.c:27:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str3="L";
            ^~~~
/sandbox/1/a.c:29:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str3="X";
            ^~~~
/sandbox/1/a.c:31:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str3="T";
            ^~~~
/sandbox/1/a.c:33:13: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
        str3="W";
            ^~~~
/sandbox/1/a.c:34:21: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
    printf("%c%c%c",&str1,&str2,&str3);
            ~~      ^~~~~
            %s
/sandbox/1/a.c:34:27: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
    printf("%c%c%c",&str1,&str2,&str3);
              ~~          ^~~~~
              %s
/sandbox/1/a.c:34:33: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
    printf("%c%c%c",&str1,&str2,&str3);
                ~~              ^~~~~
                %s
15 warnings and 1 error generated.