怎么讲接收用户输入的字符串,逆序输出呢?,在线等

解决方案 »

  1.   

    private static string bb(string a)
            {
                string b = string.Empty;
                for (int i = 0; i < a.Length; i++)
                {
                    b += a.Substring(a.Length - i - 1, 1);
                }
                return b;
            }        
      

  2.   

    Console.WriteLine("请输入内容");
                string read = Console.ReadLine().ToString();
                for (int i = read.Length - 1; i > -1; i--)
                {
                    Console.Write(read[i]);
                }
      

  3.   

            public void JudgeCommand()
            {
                string str = "123";
                StringBuilder a = new StringBuilder();
                for(int i=str.Length-1;i>=0;i--)
                {
                    a.Append(str[i]);
                }
                
                MessageBox.Show(a.ToString());
            }
      

  4.   

    Stack 类
    表示对象的简单的后进先出非泛型集合。 
    命名空间: System.Collections
    http://msdn.microsoft.com/zh-cn/library/system.collections.stack(VS.80).aspx
    http://msdn.microsoft.com/zh-cn/library/system.collections.stack_members(VS.80).aspxStack myStack = new Stack();
          myStack.Push("Hello");
          myStack.Push("World");
          myStack.Push("!");/* 
    This code produces the following output.
    myStack
        Count:    3
        Values:    !    World    Hello
    */ 
      

  5.   

    using System;
    using System.Collections.Generic;
    using System.Text;namespace ConsoleApplication3
    {
        class Program
        {
            static void Main(string[] args)
            {
                string re = Console.ReadLine();            
                for (int i = 0; i < re.Length; i++)
                {
                    Console.Write(re[re.Length - i-1]);                
                }
                Console.ReadLine();
            }
        }
    }