Console.WriteLine("输入字符:");
string s;
s = Console.ReadLine();//键盘输入一个字符串
Console.WriteLine("输入的字符对应的ASCII码:");
for (int i = 0; i < s.Length; i++)//每一个字符分别转成ASCII
{
Console.Write(Convert.ToInt32(s[i])+" ");
if (i > 0 && i % 10 == 0)
{
Console.WriteLine();
}
}
Console.WriteLine();
Console.WriteLine("ASCII码转换成字符:");
for (int i = 0; i <s.Length; i++)
{
Console.Write((char )s[i]+" ");
if (i > 0 && i % 10 == 0)
{
Console.WriteLine();