Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
111133 | 秦浩然 | 字符串相等判断 | C++ | Compile Error | 0 MS | 0 KB | 232 | 2025-02-28 20:39:57 |
#include<iostream> using namespace std; int main(){ char*str1="abc"; char*str2="abc"; if(strcmp(str1,str2)==0){ cout<<"yes"<<endl; } else{ cout<<"no"<<endl; } return 0; }
Main.cc: In function 'int main()': Main.cc:4:15: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] char*str1="abc"; ^ Main.cc:5:15: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] char*str2="abc"; ^ Main.cc:6:24: error: 'strcmp' was not declared in this scope if(strcmp(str1,str2)==0){ ^