Archived
1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SomeLab/CS/lab10/10_5/Program.cs
2026-03-19 19:39:01 +08:00

33 lines
973 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text;
namespace _10_5
{
internal class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
bool bContinue = true;
while (bContinue)
{
Console.Write("请输入英文单词:");
string s =Console.ReadLine();
if (s != "")
{
sb.Append(s);
sb.Append(" ");
}
else
{
bContinue = false;
}
}
string str = sb.ToString();
Console.WriteLine("共{0}字符,内容为{1}",sb.Length,str);
string[] source = str.ToLower().Split(new char[] { '.', '?', '!', ':', '', '' }, StringSplitOptions.RemoveEmptyEntries);
Array.Sort(source);
foreach (string s in source) Console.WriteLine(s);
}
}
}