如下边代码所示,我写在了一个按钮事件里,点击按钮,没结果,也不报错,新手刚学习C#,求具体指导,谢谢protected void btn1_Click(object sender, EventArgs e) { //随机产生100个元素的数组 int[] intArr = new int[100]; ArrayList myList = new ArrayList(); Random rnd = new Random(); while (myList.Count < 100) { int num = rnd.Next(1, 100); if (!myList.Contains(num)) myList.Add(num); } for (int i = 0; i < 100; i++) intArr[i] = (int)myList[i]; for (int j = 0; j < intArr.Length; j++) { Console.Write("{0},\t", intArr[j]); } }
- 2 回答
- 0 关注
- 589 浏览
添加回答
举报
0/150
提交
取消