| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 72403 | 李雨昊 | 字符倒序 | C++ | Compile Error | 0 MS | 0 KB | 547 | 2024-05-05 17:46:50 |
#include <stdio.h> char c[100]; int count = 0; int main(){ void antitone(char c[]); int i; printf("请输入字符串:\n"); gets(c); antitone(c); printf("字符串反序存放为:\n"); puts(c) } void antitone(char c[]){ int i; char cha; while(c[count] != '\0') count++; count--;//此时的c[count]是'\0',所以count-1,'\0'不用交换 for(i = 0;i <= count / 2;i++){ cha = c[i]; c[i] = c[count - i]; c[count - i] = cha; } }
Main.cc: In function 'int main()':
Main.cc:8:5: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(c);
^
In file included from Main.cc:1:0:
/usr/include/stdio.h:638:14: note: declared here
extern char *gets (char *__s) __wur __attribute_deprecated__;
^
Main.cc:8:5: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(c);
^
In file included from Main.cc:1:0:
/usr/include/stdio.h:638:14: note: declared here
extern char *gets (char *__s) __wur __attribute_deprecated__;
^
Main.cc:8:11: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
gets(c);
^
In file included from Main.cc:1:0:
/usr/include/stdio.h:638:14: note: declared here
extern char *gets (char *__s) __wur __attribute_deprecated__;
^
Main.cc:12:1: error: expected ';' before '}' token
}
^
Main.cc:6:9: warning: unused variable 'i' [-Wunused-variable]
int i;
^
Main.cc:8:12: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
gets(c);
^