键盘输入一行字符串,每个单词倒序输出

来源:互联网 发布:客户数据库表格图片 编辑:程序博客网 时间:2024/04/29 18:42
using System;namespace ConsoleApplication2{    class Program    {        // 键盘输入一行字符串,每个单词倒序输出        static void Main(string[] args)        {            Console.WriteLine("请输入一行字符串:");            string str = Console.ReadLine();            string[] words = str.Split(' ');            for (int i = words.Length - 1; i >= 0; i--)            {                Console.Write(words[i] + " ");            }                        Console.ReadKey();        }    }}


原创粉丝点击