using System;
namespace ConsoleApplication2
{
class Program
{
// 键盘输入一行字符串,倒序输出
static void Main(string[] args)
{
Console.WriteLine("请输入一行字符串:");
string str = Console.ReadLine();// 可以把字符串看成是只读的字符数组
for (int i = str.Length - 1; i >= 0; i-- )
{
Console.Write(str[i] + " ");
}
Console.ReadKey();
}
}
}
键盘输入一行字符串,每个字符倒序输出
最新推荐文章于 2022-12-30 19:23:03 发布