using System;
namespace CSharp
{
class Program
{
static void Main(string[] args)
{
bool shutdown = true;
while (shutdown)
{
Console.Write("\n请输入一个IP地址:");
string ipAddr = Console.ReadLine();
if (ipAddr.Length >= 7 && ipAddr.Length <= 15)
{
string[] splitIP = new string[4];
for (int i = 0; i < 3; i++)
{
splitIP = ipAddr.Split('.');
}
bool flag = true;
for (int i = 0; i < splitIP.Length; i++)
{
if (int.Parse(splitIP[i]) < 0 || int.Parse(splitIP[i]) > 255)
{
Console.WriteLine("提示:IP格式有误!");
09-30
717
06-21
1304
06-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交