using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace csharp1
{
class Program
{
static void PrintArr(int ArrLength)
{
int []arr=new int [ArrLength];
for(int i=0;i<arr.Length;i++)
arr[i]=i;
Console.WriteLine("Print Array's value");
for(int i=0;i<arr.Length;i++)
Console.WriteLine("arr[{0}]={1}",i,arr[i]);
}
static void Main(string[] args)
{
int i = 1;
while(i>0)
{
Console.WriteLine("Please enter the array's length:");
i = Int32.Parse(Console.ReadLine()); //32.Parse()表示将数字的字符串转换为32 位有符号整数,属于内容转换[1]。
PrintArr(i);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace csharp1
{
class Program
{
static void PrintArr(int ArrLength)
{
int []arr=new int [ArrLength];
for(int i=0;i<arr.Length;i++)
arr[i]=i;
Console.WriteLine("Print Array's value");
for(int i=0;i<arr.Length;i++)
Console.WriteLine("arr[{0}]={1}",i,arr[i]);
}
static void Main(string[] args)
{
int i = 1;
while(i>0)
{
Console.WriteLine("Please enter the array's length:");
i = Int32.Parse(Console.ReadLine()); //32.Parse()表示将数字的字符串转换为32 位有符号整数,属于内容转换[1]。
PrintArr(i);
}
}
}
}