| 全能ASP/PHP/ASP.NET主机,支持月付 | 专业 MSSQL 数据库空间,支持月付 | 专业 MySQL 数据库空间,支持月付 | 学习型 ASP/PHP/ASP.NET 主机 30元/年 |
| 高端软件开发 = 年薪十万不是梦 | 赛孚耐:软件保护加密专家 | 身份认证令牌USB KEY |

(1)
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
string str=Console.ReadLine();
if(str.Length!=5)
{
Console.WriteLine("请输入5个数字");
return;
}
for(int i=0;i<5;i++)
{
if(!char.IsDigit(str,i))
{
Console.Write("第"+i.ToString()+"个字符不是数字");
return;
}
}
string str1="";
for(int i=4;i>=0;i--)
{
str1+=str[i].ToString()+" ";
}
str1=str1.TrimEnd();
Console.WriteLine(str1);
}
}

(2)
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
string str=Console.ReadLine();
for(int i=0;i<str.Length;i++)
{
if(!char.IsDigit(str,i))
{
Console.WriteLine("字符串含有非数字字符");
return;
}
}
int num=0;
try
{
num=int.Parse(str);
}
catch(Exception ex)
{
Console.WriteLine("转换失败,原因:"+ex.Message);
return;
}
byte[] b=BitConverter.GetBytes(num);
str="";
for(int i=0;i<4;i++)
{
str+=b[i].ToString()+" ";
}
str=str.TrimEnd();
Console.WriteLine(str);
}
}
