1 //problem Description2 //enter a string to determine whether it is a valid identifier for C. 3 //4 //5 //Input6 //The input data contains multiple test instances, and the first row of the data is an integer n, representing the number of test instances, followed by n rows of input data, each of which is a string of no more than 50 length. 7 //8 //9 //OutputTen //for each set of input data, output one line. If the input data is a valid identifier for C, output "yes", otherwise, output "no". One A#include <stdio.h> -#include <string.h> - intMain () the { - intN; - - while(SCANF ("%d", &n)! =EOF) + { - GetChar (); + while(n--) A { at Chara[ -];intk=0, tag=0, s=1; - gets (a); - -k=strlen (a); - for(inti =0; I < K; ++i) - { in if(i==0) - { to if((A[i) <'a'&& A[i] >'_') || A[i] >'Z'|| a[i]<'A'|| (a[i]<'_'&& a[i]>'Z' )) + { -tag=1; the } * } $ if(i>0&&tag!=1)Panax Notoginseng { - the + if(A[i] = ='_'|| (A[i] >='A'&& A[i] <='Z') || (A[i] >='a'&& A[i] <='Z') || (A[i] >='0'&& A[i] <='9' )) A { thes=s+1; + } - $ } $ - - } the - if(s==k)Wuyiprintf"Yes"); the if(s!=k| | tag==1) -printf"No"); Wuprintf"\ n"); - About } $ } -}
C-Language legal identifiers