Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117047 | 毛靖平 | 字符串长度判断 | C++ | Compile Error | 0 MS | 0 KB | 325 | 2025-04-13 14:45:40 |
#include<iostream> using namespace std; int main(){ char a[150]={},b[150]={}; cin>>a>>b; int n=0,v=0; for(int i;a[i]!="\0";i++){ n++; } for(int i;b[i]!="\0";i++){ v++; } if(a!=b){ cout<<"no"; } else{ cout<<"yes"; } return 0; }
Main.cc: In function 'int main()': Main.cc:7:21: warning: comparison with string literal results in unspecified behaviour [-Waddress] for(int i;a[i]!="\0";i++){ ^ Main.cc:7:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] Main.cc:10:21: warning: comparison with string literal results in unspecified behaviour [-Waddress] for(int i;b[i]!="\0";i++){ ^ Main.cc:10:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]