zoukankan      html  css  js  c++  java
  • 53字符逐位比较大小

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace _5_3
    {
        class Program
        {
            static void Main(string[] args)
            {
                string strA, strB;
                int i;
                bool bA;
                i = 0;
                bA = true;
    
                Console.WriteLine("请输入字符串1:");
                strA = Console.ReadLine();
                Console.WriteLine("请输入字符串2:");
                strB = Console.ReadLine();
    
                Console.WriteLine("----------------------------------------");
                while (i < strA.Length && i < strB.Length)
                {
    
                    if (strA[i] > strB[i])
                    {
                        Console.WriteLine("字符串{0} 大于 字符串{1}", strA, strB);
                        Console.WriteLine("----------------------------------------");
                        Console.ReadKey();
                        return;
    
                    }
                    if (strA[i] < strB[i])
                    {
                        Console.WriteLine("字符串{0} 小于 字符串{1}", strA, strB);
                        Console.WriteLine("----------------------------------------");
                        Console.ReadKey();
                        return;
                    }
    
                    i++;
    
                }
    
                if (i < strB.Length)
                {
                    Console.WriteLine("字符串{0} 小于 字符串{1}", strA, strB);
                    Console.WriteLine("----------------------------------------");
                    Console.ReadKey();
                    return;
                }
                if (i < strA.Length)
                {
                    Console.WriteLine("字符串{0} 大于 字符串{1}", strA, strB);
                    Console.WriteLine("----------------------------------------");
                    Console.ReadKey();
                    return;
                }
    
                Console.WriteLine("字符串{0} 等于 字符串{1}", strA, strB);
    
    
                Console.WriteLine("----------------------------------------");
                Console.ReadKey();
            }
        }
    }
  • 相关阅读:
    元素显示v-show
    条件渲染v-if
    v-bind:class
    Class绑定v-bind:class
    设定计算属性setter
    观察属性$watch
    计算属性computed
    过滤器filters
    jk_proxy实现apache+tomcat负载均衡
    (WPF)Storyboard
  • 原文地址:https://www.cnblogs.com/Wzqa/p/2790210.html
Copyright © 2011-2022 走看看