foo.cc: In function 'int main()':
foo.cc:13:14: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(str1);
^
In file included from /usr/include/stdio.h:862:0,
from foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:232:1: note: declared here
gets (char *__str)
^~~~
foo.cc:14:14: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(str2);
^
In file included from /usr/include/stdio.h:862:0,
from foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:232:1: note: declared here
gets (char *__str)
^~~~
foo.cc:15:14: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(str3);
^
In file included from /usr/include/stdio.h:862:0,
from foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:232:1: note: declared here
gets (char *__str)
^~~~
foo.cc: In function 'void str_replace(char*, char*, char*)':
foo.cc:26:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i = 0; i < strlen(str1); i += gap){
~~^~~~~~~~~~~~~~
foo.cc:29:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = i, k = 0; k < strlen(str2); j++, k++){
~~^~~~~~~~~~~~~~
foo.cc:37:52: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = i + strlen(str2), k = 0; j < strlen(str1); j++, k++){ // 保存原字符串中剩余的字符
~~^~~~~~~~~~~~~~
foo.cc:41:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = i, k = 0; k < strlen(str3); j++, k++){ // 字符串替换
~~^~~~~~~~~~~~~~
foo.cc:45:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(k = 0; k < strlen(temp); j++, k++){ // 剩余字符串回接
~~^~~~~~~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:13:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str1);
~~~~^~~~~~
foo.cc:14:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str2);
~~~~^~~~~~
foo.cc:15:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str3);
~~~~^~~~~~
/tmp/ccmOcS6u.o: In function `main':
foo.cc:(.text.startup+0x3a): warning: the `gets' function is dangerous and should not be used.
[Hydro](https://hydro.ac)提供评测服务