static void Main(string[] args)
{
Console.WriteLine("请输入一句英文");
string str = Console.ReadLine().ToLower();
//按空格分隔英文,用一个string数字接收
string[] code = str.Split(' ');
//遍历每个单词
for (int i = 0; i < code.Length; i++)
{
string e = "";
//把单词变成一个字符数字,放到charStr中
char[] charStr = code[i].ToCharArray();
//遍历单词的每个字符
for (int j = charStr.Length - 1; j >= 0; j--)
{
e += charStr[j];
}
Console.Write(e + " ");
}
Console.ReadKey();
} |