Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97190 刘珩宇 字符串长度判断 C++ Compile Error 0 MS 0 KB 528 2024-11-10 18:16:20

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ char a[151],b[151]; int i,a1,b1; for(i=0;i<=151;i++){ cin>>a[i]>>b[i]; if(a[i]=="\0"){ a1=i; } } for(i=0;i<=151;i++){ if(b[i]=="\0"){ b1=i; } } if(a1==b1){ cout<<"yes"; } else{ cout<<"no"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:14: warning: comparison with string literal results in unspecified behaviour [-Waddress]
     if(a[i]=="\0"){
              ^
Main.cc:11:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:16:14: warning: comparison with string literal results in unspecified behaviour [-Waddress]
     if(b[i]=="\0"){
              ^
Main.cc:16:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]