Legal identifier of C Language

Source: Internet
Author: User

Legal identifier of C Language
Legal identifier of C LanguageTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 39100 Accepted Submission (s): 15614


Problem Description input a string to determine whether it is a legal identifier of C.

The Input data contains multiple test instances. The first line of the data is an integer n, indicating the number of test instances, followed by n rows of Input data, each line is a string of no more than 50 characters.

Output outputs a row of input data for each group. If the input data is a valid identifier of C, "yes" is output; otherwise, "no" is output ".

Sample Input

312ajffi8x_aff  ai_2

Sample Output
Noyesno problem-solving ideas: isalpha function link: http://blog.163.com/caipeipei_love%40126/blog/static/25966032201032784630227/ isalnum function link: http://see.xidian.edu.cn/cpp/html/112.htmlsource code :#include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
Int main () {int I, n, f; char str [51]; scanf ("% d", & n); getchar (); while (n --) {gets (str); f = 1; if (str [0]! = '_'&&! Isalpha (str [0]) f = 0; I = 1; while (str [I]! = '\ 0' & f = 1) {if (str [I]! = '_'&&! Isalnum (str [I]) f = 0; I ++;} if (f = 0) printf ("no \ n "); else printf ("yes \ n");} system ("pause"); return 0 ;}
    
   
  
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.