Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
111134 | 秦浩然 | 字符串相等判断 | C++ | Compile Error | 0 MS | 0 KB | 255 | 2025-02-28 20:45:51 |
#include<stdio.h> #include<string.h> using namespace std; int main(void){ 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:5:15: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] char*str1="abc"; ^ Main.cc:6:15: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] char*str2="abc"; ^ Main.cc:8:9: error: 'cout' was not declared in this scope cout<<"yes"<