Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
124951 | 陈华仁星 | 字符串拼接 | C++ | Compile Error | 0 MS | 0 KB | 280 | 2025-07-13 08:38:40 |
#include <cstdio> #include <cstring> using namespace std; int a[10005],b[10005]; int main() { int n; scanf("%s%s",a,b); strcat(a,b); scanf("%d",&n); int len=strlen(a); for(int i=0;i<len;i++) { if(i==n) { printf("%d",a[i]); } } return 0; }
Main.cc: In function 'int main()': Main.cc:8:18: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'int*' [-Wformat=] scanf("%s%s",a,b); ^ Main.cc:8:18: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'int*' [-Wformat=] Main.cc:9:12: error: cannot convert 'int*' to 'char*' for argument '1' to 'char* strcat(char*, const char*)' strcat(a,b); ^ Main.cc:11:18: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' int len=strlen(a); ^ Main.cc:8:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%s%s",a,b); ^ Main.cc:10:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^