挑战 [英] Challenge

查看:75
本文介绍了挑战的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人给我一个挑战,需要解决,但我遇到了一些问题

Someone gave me a challenge to solve and I am having some problems


推荐答案

您是否尝试提出算法或方法来解决此问题,如果有人挑战您,您为什么不尝试尝试,如果您卡住,问问题.我敢打赌,这是家庭作业.自您发布此问题以来已超过6小时.让我给你一些提示
1):将您的数字集放入String或Integer数组中
2):使用随机数获取每个数字在数组中的位置(Rd.Next(0, 22))
3:使用While循环创建另一个数组来保存选择数字
Dim selectnum作为Integer = 0
Dim createArray作为新ArrayList
Dim rd作为新的Random
虽然createArray.count< = 5
selectnum = Rd.Next(0,22)
如果不是createArray.contains(selectnum)
createArray.Add(selectnum)
if if
if createArray.count = 5
结束,而while
结束if
End while while
这不是完整的程序,只是一个提示

kaymaf
Have you try to come up with algorithm or method to solve this, if someone challenge you why dont you make attempt then if you get stuck, ask question. I bet you, this is home work assignment. it been more than 6hrs since you posted this question. Let me give you some hints
1) : put your number set in array of String or Integer
2) :use random to get the position of of each number in the array  (Rd.Next(0,22))
3 : create another array to hold the select numbers with While loop
Dim selectnum as Integer=0
Dim createArray as New ArrayList
Dim rd as new Random
   While createArray.count <=5
   selectnum=Rd.Next(0,22)  
  if not createArray.contains(selectnum)
  createArray.Add(selectnum)
  End if
  if createArray.count=5
   Exit while
   End if
   End  while
This is not complete program but just an hints

kaymaf


这篇关于挑战的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆