foo.cc: In function 'int main()':
foo.cc:12: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:13: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:14: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:15:5: error: 'cout' was not declared in this scope
cout<<str1<<endl;
^~~~
foo.cc:15:17: error: 'endl' was not declared in this scope
cout<<str1<<endl;
^~~~
foo.cc:15:17: note: suggested alternative: 'enum'
cout<<str1<<endl;
^~~~
enum
foo.cc: In function 'void str_replace(char*, char*, char*)':
foo.cc:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i = 0; i < strlen(str1); i += gap){
~~^~~~~~~~~~~~~~
foo.cc:28:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = i, k = 0; k < strlen(str2); j++, k++){
~~^~~~~~~~~~~~~~
foo.cc:36: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:40:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j = i, k = 0; k < strlen(str3); j++, k++){ // 字符串替换
~~^~~~~~~~~~~~~~
foo.cc:44: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:12:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str1);
~~~~^~~~~~
foo.cc:13:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str2);
~~~~^~~~~~
foo.cc:14:9: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(str3);
~~~~^~~~~~
[Hydro](https://hydro.ac)提供评测服务