博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
0731函数
阅读量:5161 次
发布时间:2019-06-13

本文共 12116 字,大约阅读时间需要 40 分钟。

   注释/// <summary>

        /// 请输入邮箱格式,判断邮箱格式是否正确
        /// </summary>
        /// <param name="args"></param>

        //格式一 无参无返

        public void youxiang()
        {
            Console.Write("请输入邮箱:");
            string ss = Console.ReadLine();
            if (ss.Contains("@"))
            {
                if (ss.IndexOf("@") == ss.LastIndexOf("@"))
                {
                    if (!ss.StartsWith("@"))
                    {
                        int a = ss.IndexOf("@");
                        string sss = ss.Substring(a);
                        if (sss.Contains("."))
                        {
                            int b = sss.IndexOf(".");
                            if (b != 1)
                            {
                                if (ss.Substring(a - 1, 1) != ".")
                                {
                                    if (!ss.EndsWith("."))
                                    {
                                        Console.WriteLine("您输入的邮箱格式正确:" + ss);
                                    }
                                    else
                                    {
                                        Console.WriteLine("您输入的邮箱格式错误!");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("您输入的邮箱格式错误!");
                                }
                            }
                            else
                            {
                                Console.WriteLine("您输入的邮箱格式错误!");
                            }
                        }
                        else
                        {
                            Console.WriteLine("您输入的邮箱格式错误!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("您输入的邮箱格式错误!");
                    }
                }
                else
                {
                    Console.WriteLine("您输入的邮箱格式错误!");
                }
            }
            else
            {
                Console.WriteLine("您输入的邮箱格式错误!");
            }
            Console.ReadLine();
        }

 

        //格式二有参无返
        public void youxiang1(string ss)
        {

            if (ss.Contains("@"))

            {
                if (ss.IndexOf("@") == ss.LastIndexOf("@"))
                {
                    if (!ss.StartsWith("@"))
                    {
                        int a = ss.IndexOf("@");
                        string sss = ss.Substring(a);
                        if (sss.Contains("."))
                        {
                            int b = sss.IndexOf(".");
                            if (b != 1)
                            {
                                if (ss.Substring(a - 1, 1) != ".")
                                {
                                    if (!ss.EndsWith("."))
                                    {
                                        Console.WriteLine("您输入的邮箱格式正确:" + ss);
                                    }
                                    else
                                    {
                                        Console.WriteLine("您输入的邮箱格式错误!");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("您输入的邮箱格式错误!");
                                }
                            }
                            else
                            {
                                Console.WriteLine("您输入的邮箱格式错误!");
                            }
                        }
                        else
                        {
                            Console.WriteLine("您输入的邮箱格式错误!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("您输入的邮箱格式错误!");
                    }
                }
                else
                {
                    Console.WriteLine("您输入的邮箱格式错误!");
                }
            }
            else
            {
                Console.WriteLine("您输入的邮箱格式错误!");
            }
            Console.ReadLine();
        }

 

        //格式三有参有返

        public string youxiang2(string ss)
        {
            if (ss.Contains("@"))
            {
                if (ss.IndexOf("@") == ss.LastIndexOf("@"))
                {
                    if (!ss.StartsWith("@"))
                    {
                        int a = ss.IndexOf("@");
                        string sss = ss.Substring(a);
                        if (sss.Contains("."))
                        {
                            int b = sss.IndexOf(".");
                            if (b != 1)
                            {
                                if (ss.Substring(a - 1, 1) != ".")
                                {
                                    if (!ss.EndsWith("."))
                                    {
                                        Console.WriteLine("您输入的邮箱格式正确:" + ss);
                                        return ss;
                                    }
                                    else
                                    {
                                        Console.WriteLine("您输入的邮箱格式错误!");
                                        return "";
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("您输入的邮箱格式错误!");
                                    return "";
                                }
                            }
                            else
                            {
                                Console.WriteLine("您输入的邮箱格式错误!");
                                return "";
                            }
                        }
                        else
                        {
                            Console.WriteLine("您输入的邮箱格式错误!");
                            return "";
                        }
                    }
                    else
                    {
                        Console.WriteLine("您输入的邮箱格式错误!");
                        return "";
                    }
                }
                else
                {
                    Console.WriteLine("您输入的邮箱格式错误!");
                    return "";
                }
            }
            else
            {
                Console.WriteLine("您输入的邮箱格式错误!");
                return "";
            }

        }

        //格式四无参有返
        public string youxiang3()
        {
            Console.Write("请输入邮箱:");
            string ss = Console.ReadLine();
            if (ss.Contains("@"))
            {
                if (ss.IndexOf("@") == ss.LastIndexOf("@"))
                {
                    if (!ss.StartsWith("@"))
                    {
                        int a = ss.IndexOf("@");
                        string sss = ss.Substring(a);
                        if (sss.Contains("."))
                        {
                            int b = sss.IndexOf(".");
                            if (b != 1)
                            {
                                if (ss.Substring(a - 1, 1) != ".")
                                {
                                    if (!ss.EndsWith("."))
                                    {
                                        Console.WriteLine("您输入的邮箱格式正确:" + ss);
                                        return ss;
                                    }
                                    else
                                    {
                                        Console.WriteLine("您输入的邮箱格式错误!");
                                        return "";
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("您输入的邮箱格式错误!");
                                    return "";
                                }
                            }
                            else
                            {
                                Console.WriteLine("您输入的邮箱格式错误!");
                                return "";
                            }
                        }
                        else
                        {
                            Console.WriteLine("您输入的邮箱格式错误!");
                            return "";
                        }
                    }
                    else
                    {
                        Console.WriteLine("您输入的邮箱格式错误!");
                        return "";
                    }
                }
                else
                {
                    Console.WriteLine("您输入的邮箱格式错误!");
                    return "";
                }
            }
            else
            {
                Console.WriteLine("您输入的邮箱格式错误!");
                return "";
            }
        }

        public double[] jiafen(double[] score)
        {
            for (int i = 0; i < score.Length; i++)
            {
                score[i] += 10;

            }

            return score;
        }

        //格式一无参无返
        public void cai()
        {
            Console.Write("请输入您要出什么:");
            string s = Console.ReadLine();
            if (s == "剪刀" || s == "石头" || s == "布")
            {
                int a = 0;
                switch (s)
                {
                    case "剪刀":
                        a = 1;
                        break;
                    case "石头":
                        a = 2;
                        break;
                    case "布":
                        a = 3;
                        break;
                }
                Random ran = new Random();
                int b = ran.Next(1, 4);
                if (b == 1)
                {
                    Console.WriteLine("电脑出剪刀");
                }
                else if (b == 2)
                {
                    Console.WriteLine("电脑出石头");
                }
                else
                {
                    Console.WriteLine("电脑出布");
                }
                int c = a - b;
                if (c == 0)
                {
                    Console.WriteLine("本轮平局!");
                }
                else if (c == 1 | c == -2)
                {
                    Console.WriteLine("本轮胜出!");
                }
                else
                {
                    Console.WriteLine("本轮失败!");
                }

            }

            else
            {
                Console.WriteLine("您的输入有误!");

            }

            Console.ReadLine();
        }

 

        //格式二有参无返

        public void cai1(string s)
        {
            if (s == "剪刀" || s == "石头" || s == "布")
            {
                int a = 0;
                switch (s)
                {
                    case "剪刀":
                        a = 1;
                        break;
                    case "石头":
                        a = 2;
                        break;
                    case "布":
                        a = 3;
                        break;
                }
                Random ran = new Random();
                int b = ran.Next(1, 4);
                if (b == 1)
                {
                    Console.WriteLine("电脑出剪刀");
                }
                else if (b == 2)
                {
                    Console.WriteLine("电脑出石头");
                }
                else
                {
                    Console.WriteLine("电脑出布");
                }
                int c = a - b;
                if (c == 0)
                {
                    Console.WriteLine("本轮平局!");
                }
                else if (c == 1 | c == -2)
                {
                    Console.WriteLine("本轮胜出!");
                }
                else
                {
                    Console.WriteLine("本轮失败!");
                }

            }

            else
            {
                Console.WriteLine("您的输入有误!");

            }

            Console.ReadLine();

        }

 

        //格式三有参有返

        public string cai2(string s)
        {
            if (s == "剪刀" || s == "石头" || s == "布")
            {
                int a = 0;
                switch (s)
                {
                    case "剪刀":
                        a = 1;
                        break;
                    case "石头":
                        a = 2;
                        break;
                    case "布":
                        a = 3;
                        break;
                }
                Random ran = new Random();
                int b = ran.Next(1, 4);
                if (b == 1)
                {
                    Console.WriteLine("电脑出剪刀");
                }
                else if (b == 2)
                {
                    Console.WriteLine("电脑出石头");
                }
                else
                {
                    Console.WriteLine("电脑出布");
                }
                int c = a - b;
                if (c == 0)
                {
                    return "本轮平局!";
                }
                else if (c == 1 | c == -2)
                {
                    return "本轮胜出!";
                }
                else
                {
                    return "本轮失败!";
                }

            }

            else
            {
                return "您的输入有误!";

            }

        }

        //格式四无参有返
        public string cai3()
        {
            Console.Write("请输入您要出什么:");
            string s = Console.ReadLine();
            if (s == "剪刀" || s == "石头" || s == "布")
            {
                int a = 0;
                switch (s)
                {
                    case "剪刀":
                        a = 1;
                        break;
                    case "石头":
                        a = 2;
                        break;
                    case "布":
                        a = 3;
                        break;
                }
                Random ran = new Random();
                int b = ran.Next(1, 4);
                if (b == 1)
                {
                    Console.WriteLine("电脑出剪刀");
                }
                else if (b == 2)
                {
                    Console.WriteLine("电脑出石头");
                }
                else
                {
                    Console.WriteLine("电脑出布");
                }
                int c = a - b;
                if (c == 0)
                {
                    return "本轮平局!";
                }
                else if (c == 1 | c == -2)
                {
                    return "本轮胜出!";
                }
                else
                {
                    return "本轮失败!";
                }

            }

            else
            {
                return "您的输入有误!";

            }

        }

 

        //格式一无参无返
        public void jiankang()
        {
            Console.Write("请输入您的性别:");
            string x = Console.ReadLine();
            Console.Write("请输入您的体重:");
            double t = double.Parse(Console.ReadLine());
            Console.Write("请输入您的身高:");
            double s = double.Parse(Console.ReadLine());
            for (int i = 1; i > 0; i++)
            {
                if (x == "男" || x == "女")
                {
                    if (x == "男")
                    {
                        if (t > s - 100 + 3)
                        {
                            Console.WriteLine("您偏胖!");
                        }
                        else if (t < s - 100 - 3)
                        {
                            Console.WriteLine("您偏瘦!");
                        }
                        else
                        {
                            Console.WriteLine("您很健康!");
                        }
                    }
                    else
                    {
                        if (t > s - 110 + 3)
                        {
                            Console.WriteLine("您偏胖!");
                        }
                        else if (t < s - 110 - 3)
                        {
                            Console.WriteLine("您偏瘦!");
                        }
                        else
                        {
                            Console.WriteLine("您很健康!");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("您输入的性别有误!");
                }
                break;
            }
            Console.ReadLine();
        }

 

        //格式二有参无返

        public void jiankang1(string x, double t, double s)
        {
            for (int i = 1; i > 0; i++)
            {
                if (x == "男" || x == "女")
                {
                    if (x == "男")
                    {
                        if (t > s - 100 + 3)
                        {
                            Console.WriteLine("您偏胖!");
                        }
                        else if (t < s - 100 - 3)
                        {
                            Console.WriteLine("您偏瘦!");
                        }
                        else
                        {
                            Console.WriteLine("您很健康!");
                        }
                    }
                    else
                    {
                        if (t > s - 110 + 3)
                        {
                            Console.WriteLine("您偏胖!");
                        }
                        else if (t < s - 110 - 3)
                        {
                            Console.WriteLine("您偏瘦!");
                        }
                        else
                        {
                            Console.WriteLine("您很健康!");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("您输入的性别有误!");
                }
                break;
            }
            Console.ReadLine();
        }

 

        //格式三有参有返

        public object jiankang2(string x, double t, double s)
        {

            if (x == "男" || x == "女")

            {
                if (x == "男")
                {
                    if (t > s - 100 + 3)
                    {
                        return "您偏胖!";
                    }
                    else if (t < s - 100 - 3)
                    {
                        return "您偏瘦!";
                    }
                    else
                    {
                        return "您很健康!";
                    }
                }
                else
                {
                    if (t > s - 110 + 3)
                    {
                        return "您偏胖!";
                    }
                    else if (t < s - 110 - 3)
                    {
                        return "您偏瘦!";
                    }
                    else
                    {
                        return "您很健康!";
                    }
                }
            }
            else
            {
                return "您输入的性别有误!";
            }

        }

        //格式四无参有返
        public object jiankang3()
        {
            Console.Write("请输入您的性别:");
            string x = Console.ReadLine();
            Console.Write("请输入您的体重:");
            double t = double.Parse(Console.ReadLine());
            Console.Write("请输入您的身高:");
            double s = double.Parse(Console.ReadLine());
            Program jian = new Program();
            if (x == "男" || x == "女")
            {
                if (x == "男")
                {
                    if (t > s - 100 + 3)
                    {
                        return "您偏胖!";
                    }
                    else if (t < s - 100 - 3)
                    {
                        return "您偏瘦!";
                    }
                    else
                    {
                        return "您很健康!";
                    }
                }
                else
                {
                    if (t > s - 110 + 3)
                    {
                        return "您偏胖!";
                    }
                    else if (t < s - 110 - 3)
                    {
                        return "您偏瘦!";
                    }
                    else
                    {
                        return "您很健康!";
                    }
                }
            }
            else
            {
                return "您输入的性别有误!";
            }

        }

 

        static void Main(string[] args)
        {
            //格式1
            //Program mail = new Program();
            //mail.youxiang();

            //格式2

            //Program mail = new Program();
            //Console.Write("请输入邮箱:");
            //mail.youxiang1(Console.ReadLine());

            //格式3

            //Program mail = new Program();
            //Console.Write("请输入邮箱:");
            //string bb=mail.youxiang2(Console.ReadLine());
            //Console.ReadLine();                                           

            //格式4

            //Program mail = new Program();
            //string cc = mail.youxiang3();
            //Console.ReadLine();

            //输入班级人数,对应分数
            //每个人加十分
            //Console.Write("请输入班级人数:");
            //int a = int.Parse(Console.ReadLine());
            //double[] score = new double[a];
            //for (int i = 0; i < a;i++ )
            //{
            //    Console.Write("请输入第{0}个人的分数:",i);
            //    score[i] = double.Parse(Console.ReadLine());
            //}

            //Program aa = new Program();

            //score = aa.jiafen(score);
            //foreach(double aaa in score)
            //{
            //    Console.Write(aa + "\t");
            //}
            //Console.ReadLine();

            //猜拳
            //剪刀   1
            //石头   2
            //布     3
            //Console.Write("请输入您要出什么:");
            //string s = Console.ReadLine();
            //if(s=="剪刀"||s=="石头"||s=="布")
            //{ 
            //    int a=0;                      
            //    switch(s)
            //   {
            //    case "剪刀":
            //         a = 1;
            //         break;
            //    case "石头":
            //         a = 2;
            //         break;
            //    case "布":
            //         a = 3;
            //         break;
            //    }
            //  Random ran=new Random();
            //  int b=ran.Next(1,4);
            //  if(b==1)
            //  {
            //      Console.WriteLine("电脑出剪刀");
            //  }
            //  else if(b==2)
            //  {
            //     Console.WriteLine("电脑出石头");
            //  }
            //  else
            //  {
            //     Console.WriteLine("电脑出布");
            //  }
            //   int c=a-b;
            //    if(c==0)
            //    {
            //       Console.WriteLine("本轮平局!");
            //    }
            //    else  if(c==1|c==-2)
            //    {
            //       Console.WriteLine("本轮胜出!");
            //    }
            //    else
            //    {
            //       Console.WriteLine("本轮失败!");
            //    }

            //}

            //else
            //{
            //  Console.WriteLine("您的输入有误!");

            //}

            // Console.ReadLine();

 

 

            //格式1

            //Program aa = new Program();
            //aa.cai();

            //格式2

            //Console.Write("请输入你要出什么:");
            //string aa = Console.ReadLine();
            //Program cc = new Program();
            //cc.cai1(aa);

            //格式3

            //Console.Write("请输入你要出什么:");
            //string aa = Console.ReadLine();
            //Program cc = new Program();
            //string dd=cc.cai2(aa);
            //Console.WriteLine(dd);
            //Console.ReadLine();

            //格式4

            //Program aa = new Program();
            //string dd = aa.cai3();
            //Console.WriteLine(dd);
            //Console.ReadLine();

            //for (int i = 1; i > 0; i++)
            //{
            //    Console.Write("请输入年份:");
            //    int n = int.Parse(Console.ReadLine());
            //    if (n >= 0 && n <= 9999)
            //    {
            //        for (int j = 1; j > 0; j++)
            //        {
            //            Console.Write("请输入月份:");
            //            int m = int.Parse(Console.ReadLine());
            //            if (m >= 1 && m <= 12)
            //            {
            //                for (int k = 1; k > 0; k++)
            //                {
            //                    Console.Write("请输入日期:");
            //                    int d = int.Parse(Console.ReadLine());
            //                    if (d >= 1 && d <= 31)
            //                    {
            //                        if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
            //                        {
            //                            Console.WriteLine("您输入的日期格式正确!" + n + "年" + m + "月" + d + "日.");
            //                            break;
            //                        }
            //                        else if (m == 4 || m == 6 || m == 9 || m == 11)
            //                        {
            //                            for (int a = 1; a > 0; a++)
            //                            {
            //                                if (d <= 30)
            //                                {
            //                                    Console.WriteLine("您输入的日期格式正确!" + n + "年" + m + "月" + d + "日.");
            //                                    break;
            //                                }
            //                                else
            //                                {
            //                                    Console.WriteLine("您输入的日期格式有误!请从新输入!");
            //                                }  
            //                            }        break;

            //                        }

            //                        else
            //                        {
            //                            for (int b = 1; b > 0; b++)
            //                            {
            //                                if (d <= 28)
            //                                {
            //                                    Console.WriteLine("您输入的日期格式正确!" + n + "年" + m + "月" + d + "日.");
            //                                    break;
            //                                }

            //                                else if (d == 29)

            //                                {
            //                                    for (int c = 1; c > 0; c++)
            //                                    {
            //                                        if (n % 4 == 0 && n % 100 != 0 || n % 400 == 0)
            //                                        {
            //                                            Console.WriteLine("您输入的日期格式正确!" + n + "年" + m + "月" + d + "日.");
            //                                                break;
            //                                        } 
            //                                        else
            //                                        {
            //                                            Console.WriteLine("您输入的日期格式有误!请从新输入!");
            //                                        }
            //                                        break;
            //                                    }
            //                                    break;
            //                                }
            //                                else
            //                                {
            //                                    Console.WriteLine("您输入的日期格式有误!请从新输入");
            //                                }
            //                                break;
            //                            }
            //                            break;
            //                        }

            //                    }

            //                    else
            //                    {
            //                        Console.WriteLine("您输入的日期有误!请从新输入!");
            //                    }

            //                }

            //                break;
            //            }
            //            else
            //            {
            //                Console.WriteLine("您输入的月份有误!请从新输入!");
            //            }

            //        }

            //        break;
            //    }
            //    else
            //    {
            //        Console.WriteLine("您输入的年份有误!请从新输入!");
            //    }
            //}
            //Console.ReadLine();

            //格式1
            //Program jian = new Program();
            //jian.jiankang();

            //格式2

            //Console.Write("请输入您的性别:");
            //string x = Console.ReadLine();
            //Console.Write("请输入您的体重:");
            //double t = double.Parse(Console.ReadLine());
            //Console.Write("请输入您的身高:");
            //double s = double.Parse(Console.ReadLine());
            //Program jian = new Program();
            //jian.jiankang1(x, t, s);

            //格式3

            // Console.Write("请输入您的性别:");
            // string x = Console.ReadLine();
            // Console.Write("请输入您的体重:");
            // double t = double.Parse(Console.ReadLine());
            // Console.Write("请输入您的身高:");
            // double s = double.Parse(Console.ReadLine());
            // Program jian = new Program();
            //Console.WriteLine( jian.jiankang2(x, t, s));
            //Console.ReadLine();

            //格式4

            //Program jian = new Program();
            //Console.WriteLine(jian.jiankang3());
            //Console.ReadLine();

转载于:https://www.cnblogs.com/a12110303043/p/5723362.html

你可能感兴趣的文章
求出斐波那契数组
查看>>
lr_start_transaction/lr_end_transaction事物组合
查看>>
CodeIgniter学习笔记(四)——CI超级对象中的load装载器
查看>>
.NET CLR基本术语
查看>>
ubuntu的home目录下,Desktop等目录消失不见
查看>>
建立,查询二叉树 hdu 5444
查看>>
[Spring框架]Spring 事务管理基础入门总结.
查看>>
2017.3.24上午
查看>>
Python-常用模块及简单的案列
查看>>
LeetCode 159. Longest Substring with At Most Two Distinct Characters
查看>>
LeetCode Ones and Zeroes
查看>>
基本算法概论
查看>>
jquery动态移除/增加onclick属性详解
查看>>
JavaScript---Promise
查看>>
暖暖的感动
查看>>
Java中的日期和时间
查看>>
Django基于admin的stark组件创建(一)
查看>>
抛弃IIS,利用FastCGI让Asp.net与Nginx在一起
查看>>
C. Tanya and Toys_模拟
查看>>
springboot jar包运行中获取资源文件
查看>>