Mã chấm Tài khoản Bài tập Ngôn ngữ lập trình Trạng thái Thời gian Bộ nhớ Kích thước Thời gian nộp
268378 Lê Huỳnh Ngọc Chuỗi lớn nhất C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 527 2023-11-18 20:09:04

Lỗi biên dịch:

Main.cc: In function ‘int main()’:
Main.cc:11:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
         if(a[i]='?'){
            ~~~~^~~~
Main.cc:12:22: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
             if(a[i-1]='a')
                ~~~~~~^~~~
Main.cc:14:22: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
             if(a[i+1]='b')
                ~~~~~~^~~~
Main.cc:16:9: error: expected ‘;’ before ‘}’ token
         }
         ^
Main.cc:18:20: error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]
      {if(strcat(a[j],a[j+1])=="ab")
                 ~~~^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:126:1: note:   initializing argument 1 of ‘char* strcat(char*, const char*)’
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
Main.cc:18:27: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
      {if(strcat(a[j],a[j+1])=="ab")
                      ~~~~~^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:126:1: note:   initializing argument 2 of ‘char* strcat(char*, const char*)’
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
Main.cc:18:31: warning: comparison with string literal results in unspecified behavior [-Waddress]
      {if(strcat(a[j],a[j+1])=="ab")
                               ^~~~
Main.cc:20:22: error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]
         if(strcat(a[j],a[j+1])=="ba")
                   ~~~^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:126:1: note:   initializing argument 1 of ‘char* strcat(char*, const char*)’
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
Main.cc:20:29: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
         if(strcat(a[j],a[j+1])=="ba")
                        ~~~~~^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:126:1: note:   initializing argument 2 of ‘char* strcat(char*, const char*)’
 __NTH (strcat (char *__restrict __dest, const char *__restrict __src))
 ^
Main.cc:20:33: warning: comparison with string literal results in unspecified behavior [-Waddress]
         if(strcat(a[j],a[j+1])=="ba")
                                 ^~~~