运行 ID: 32006

Main.cc:1:1: error: ‘include’ does not name a type; did you mean ‘__has_include’?
 include "string.h"
 ^~~~~~~
 __has_include
Main.cc: In function ‘void str_replace(char*, int, char*)’:
Main.cc:9:16: error: ‘strlen’ was not declared in this scope
     lenofstr = strlen(str);
                ^~~~~~
Main.cc:9:16: note: suggested alternative: ‘str’
     lenofstr = strlen(str);
                ^~~~~~
                str
Main.cc:33:5: error: ‘strncpy’ was not declared in this scope
     strncpy(cp,str,lenofstr);
     ^~~~~~~
Main.cc:33:5: note: suggested alternative: ‘struct’
     strncpy(cp,str,lenofstr);
     ^~~~~~~
     struct
Main.cc:7:9: warning: unused variable ‘i’ [-Wunused-variable]
     int i;
         ^
Main.cc: In function ‘int main()’:
Main.cc:45:5: error: ‘printf’ was not declared in this scope
     printf("\n请输入要查找的字符串和用于替换的字符串(中间用空格隔开): ");
     ^~~~~~
Main.cc:45:5: note: suggested alternative: ‘int’
     printf("\n请输入要查找的字符串和用于替换的字符串(中间用空格隔开): ");
     ^~~~~~
     int
Main.cc:46:5: error: ‘scanf’ was not declared in this scope
     scanf("%s",str2);
     ^~~~~
In file included from Main.cc:2:0:
Main.cc:49:28: error: ‘stdin’ was not declared in this scope
     freopen("news.txt","r",stdin);
                            ^
Main.cc:49:5: error: ‘freopen’ was not declared in this scope
     freopen("news.txt","r",stdin);
     ^~~~~~~
Main.cc:51:9: error: ‘getchar’ was not declared in this scope
     c = getchar();
         ^~~~~~~
Main.cc:51:9: note: suggested alternative: ‘getc’
     c = getchar();
         ^~~~~~~
         getc
Main.cc:61:9: error: ‘strstr’ was not declared in this scope
     p = strstr(str1,str2);
         ^~~~~~
Main.cc:61:9: note: suggested alternative: ‘str3’
     p = strstr(str1,str2);
         ^~~~~~
         str3
Main.cc:66:23: error: ‘strlen’ was not declared in this scope
         str_replace(p,strlen(str2),str3);
                       ^~~~~~
Main.cc:66:23: note: suggested alternative: ‘len’
         str_replace(p,strlen(str2),str3);
                       ^~~~~~
                       len
Main.cc:41:11: warning: unused variable ‘len’ [-Wunused-variable]
     int i,len,count=0;
           ^~~