如 i am a student , 输出 student a am i

解决方案 »

  1.   


                string s = "I am a student";
                string[] words = s.Split(' ');
                Array.Reverse(words);
                string result = string.Join(" ", words);
      

  2.   

    string str = "i am a student ";
                string[] temp = str.Split(' ');            for (int i = temp.Length - 1; i >= 0; i--)
                {
                    Console.Write("{0} ", temp[i]);
                }
                Console.Read();
      

  3.   

    Array.Reverse(words);
    原来可以这样啊,学习ing
      

  4.   

    private string Reverse(string s)
    {
    char[] cs = s.ToCharArray();
    int end = s.Length - 1;
    int length = 0;
    string result = string.Empty;
    while(end >= 0)
    {
    while(end >= 0 && cs[end] != ' ')
    {
    length++;
    end --;
    }
    result += new string(cs, end+1, length);
    result += " ";
    length = 0;
    end --;
    }
    return result;
    }