记录详情

Compile Error

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)提供评测服务

信息

递交者
类型
递交
题目
P1052 OO11-4 string中的查找替换
语言
C++
递交时间
2021-08-13 16:31:59
评测时间
2021-08-13 16:33:36
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes