Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147084 吴诗涵 合法的标识符 C++ Compile Error 0 MS 0 KB 534 2026-02-02 17:11:50

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(){ string a; cin>>a; if(a[0]>='0'&&a[0]<='9'){ cout<<"no"; return 0; } for(int i=0;i<a.size();i++){ if(!(a[i]>='A'&&a[i]<='Z' || a[i]>='a'&&a[i]<='z' || a[i]=='_' || a[i]>='0'&&a[i]<='9')) cout<<"no"; return 0; } } cout<<"yes"; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int i=0;i='A'&&a[i]<='Z' || a[i]>='a'&&a[i]<='z' || a[i]=='_' || a[i]>='0'&&a[i]<='9'))
                   ^
Main.cc:15:80: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if(!(a[i]>='A'&&a[i]<='Z' || a[i]>='a'&&a[i]<='z' || a[i]=='_' || a[i]>='0'&&a[i]<='9'))
                                                                                ^
Main.cc: At global scope:
Main.cc:20:1: error: 'cout' does not name a type
 cout<<"yes";
 ^
Main.cc:21:1: error: expected unqualified-id before 'return'
 return 0;
 ^
Main.cc:22:1: error: expected declaration before '}' token
 }
 ^