当前位置: 代码迷 >> 综合 >> 键盘输入一行字符串,每个单词倒序输出
  详细解决方案

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

热度:15   发布时间:2024-01-17 03:37:14.0
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();}}}


  相关解决方案