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
268098 Trần Tấn Đạt Chuỗi lớn nhất C/C++ Lỗi biên dịch (CE) 0 MS 0 KB 574 2023-11-18 19:50:09

Lỗi biên dịch:

Main.cc: In function ‘int main()’:
Main.cc:11:11: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations]
     gets(a);
           ^
In file included from /usr/include/stdio.h:862:0,
                 from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:232:1: note: declared here
 gets (char *__str)
 ^~~~
Main.cc:15:13: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if((a[i]=="a" && a[i+1]=="a") ||( a[i]=="b"&&a[i+1]=="b"))
             ^~~
Main.cc:15:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:15:28: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if((a[i]=="a" && a[i+1]=="a") ||( a[i]=="b"&&a[i+1]=="b"))
                            ^~~
Main.cc:15:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:15:43: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if((a[i]=="a" && a[i+1]=="a") ||( a[i]=="b"&&a[i+1]=="b"))
                                           ^~~
Main.cc:15:43: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:15:56: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if((a[i]=="a" && a[i+1]=="a") ||( a[i]=="b"&&a[i+1]=="b"))
                                                        ^~~
Main.cc:15:56: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:17:23: warning: comparison with string literal results in unspecified behavior [-Waddress]
         else if(a[i]=="a"&&a[i+1]=="b")
                       ^~~
Main.cc:17:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:17:36: warning: comparison with string literal results in unspecified behavior [-Waddress]
         else if(a[i]=="a"&&a[i+1]=="b")
                                    ^~~
Main.cc:17:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:19:23: warning: comparison with string literal results in unspecified behavior [-Waddress]
         else if(a[i]=="b"&&a[i+1]=="a")
                       ^~~
Main.cc:19:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:19:36: warning: comparison with string literal results in unspecified behavior [-Waddress]
         else if(a[i]=="b"&&a[i+1]=="a")
                                    ^~~
Main.cc:19:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
Main.cc:11:9: warning: ignoring return value of ‘char* gets(char*)’, declared with attribute warn_unused_result [-Wunused-result]
     gets(a);
     ~~~~^~~