统一归档20260319
This commit is contained in:
32
CS/lab10/10_5/Program.cs
Normal file
32
CS/lab10/10_5/Program.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user