zoukankan      html  css  js  c++  java
  • 验证用户名和密码,输入三次不正确就锁定账号

    using System;
    using System.Globalization;
    
    class Program
    {
        public static void Main(string[] args)
        {
            var count = 3;
            for (int i = 0; i < count; i++)
            {
                var username = GetString();
                var password = GetString();
                if (username == "zxl" && password == "zxl")
                {
                    Print(username);
                    Print(password);
                    break;
                }
            }
            if (count == 3)
            {
                Print("lock");
            }
        } //Main函数结束
    
    
        #region 工具方法
    
        public static void Print(string obj, params object[] arg)
        {
            Console.WriteLine(obj, arg);
        }
    
        public static void Print(object obj)
        {
            Console.WriteLine(obj);
        }
    
        /// <summary>
        /// 获得一个int类型的值
        /// </summary>
        /// <returns></returns>
        public static int GetInt()
        {
            int i;
            while (true)
            {
                try
                {
                    i = Convert.ToInt32(Console.ReadLine());
                    break;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            return i;
        }
    
        public static string GetString()
        {
            return Console.ReadLine();
        }
    
        public static double GetDouble()
        {
            double i;
            while (true)
            {
                try
                {
                    i = Convert.ToDouble(Console.ReadLine());
                    break;
                }
                catch (FormatException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            return i;
        }
    
        #endregion
    }
  • 相关阅读:
    C#.NET Winform 快速开发平台
    .Net C/S系统开发框架(楚楚原创)
    C# Winform 开发框架
    php导出excel表格超链接
    tp3使用PHPExcel 导出excel
    tp文件上传、表格转数组
    BUG修复记录
    tp3切库问题记录
    个人总结
    初识爬虫(番外篇-python)
  • 原文地址:https://www.cnblogs.com/zhaoxianglong1987/p/7606574.html
Copyright © 2011-2022 走看看