试题详情
简答题产生一个int数组,长度为100,并向其中随机插入1-100,并且不能重复。
  • int[]intArr=newint[100];
    ArrayListmyList=newArrayList();
    Randomrnd=newRandom();
    while(myList.Count<100)
    {
    intnum=rnd.Next(1,101);
    if(!myList.Contains(num))
    myList.Add(num);
    }
    for(inti=0;i<100;i++)
    intArr[i]=(int)myList[i];
  • 关注下方微信公众号,在线模考后查看

热门试题