码迷,mamicode.com
首页 > 其他好文 > 详细

标识符

时间:2018-10-20 14:59:18      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:选项   lse   code   static   i++   pre   space   class   模板   

/*
 * 由SharpDevelop创建。
 * 用户: Administrator
 * 日期: 2018/10/20
 * 时间: 12:22
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;

namespace C工资1
{
    class Program
    {
        public static void Main(string[] args)
        {
            
                string str=Console.ReadLine();
            bool isRinght=true;
            if ((str[0]>=‘a‘&&str[0]<=‘z‘ ) ||(str[0]>=‘A‘&&str[0]<=‘Z‘)||(str[0]>=‘_‘)||(str[0]<=‘@‘)) {
            
            }else{
                isRinght=false;
            }
            for (int i = 1; i < str .Length ; i++) {
                if ((str[i]>=‘a‘&&str[i]<=‘z‘ ) ||(str[i]>=‘A‘&&str[i]<=‘Z‘)||str[i]>=‘_‘||(str[i]>=‘0‘&&str[i]<=‘9‘)) {
                    
                }else{
                isRinght=false;
                }
            }
            if (isRinght=false) {
                    Console.WriteLine("不是合法的标识符");
            }else{
            
            Console.WriteLine("是合法的标识符");
            
            }
            Console.ReadKey();
        }

    }

}

asdfd

是合法的标识符

标识符

标签:选项   lse   code   static   i++   pre   space   class   模板   

原文地址:https://www.cnblogs.com/llhhcc/p/9821444.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!