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
268470 Phạm Quang Nghĩa Chuỗi lớn nhất C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 432 2023-11-18 20:15:27

Lỗi biên dịch:

Main.cc: In function ‘int main()’:
Main.cc:9:18: error: expected unqualified-id before ‘?’ token
     const char * ?="2",a="3",b="4";
                  ^
Main.cc:9:18: error: expected initializer before ‘?’ token
Main.cc:15:26: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
             if(strcmp(s[i],s[i+1])<0)
                       ~~~^
In file included from Main.cc:2:0:
/usr/include/string.h:136:12: note:   initializing argument 1 of ‘int strcmp(const char*, const char*)’
 extern int strcmp (const char *__s1, const char *__s2)
            ^~~~~~
Main.cc:15:33: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
             if(strcmp(s[i],s[i+1])<0)
                            ~~~~~^
In file included from Main.cc:2:0:
/usr/include/string.h:136:12: note:   initializing argument 2 of ‘int strcmp(const char*, const char*)’
 extern int strcmp (const char *__s1, const char *__s2)
            ^~~~~~
Main.cc:18:30: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
      tong = tong + strcmp(s[i],s[i+1]);
                           ~~~^
In file included from Main.cc:2:0:
/usr/include/string.h:136:12: note:   initializing argument 1 of ‘int strcmp(const char*, const char*)’
 extern int strcmp (const char *__s1, const char *__s2)
            ^~~~~~
Main.cc:18:37: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
      tong = tong + strcmp(s[i],s[i+1]);
                                ~~~~~^
In file included from Main.cc:2:0:
/usr/include/string.h:136:12: note:   initializing argument 2 of ‘int strcmp(const char*, const char*)’
 extern int strcmp (const char *__s1, const char *__s2)
            ^~~~~~
Main.cc:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~