求用C# 语言的从1-10个数中选5个数的代码,是组合。不是排列。。

[复制链接]
查看11 | 回复5 | 2011-9-28 16:48:56 | 显示全部楼层 |阅读模式
不知道你要求的结果是什么,我这个返回的是一组5位随机数,但愿对你有用!!!private int randonData()
{
Random r = new Random();
return r.Next(1, 10);
}
private string Creat()
{
string str="";
while(str.Length<5)
{
int n = randonData();
...
回复

使用道具 举报

千问 | 2011-9-28 16:48:56 | 显示全部楼层
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{
class HW1
{
static void Main(string[] ...
回复

使用道具 举报

千问 | 2011-9-28 16:48:56 | 显示全部楼层
这个函数我也看到了,可是它的返回值是Image类型,而Image类是包含在System.Drawing里的,所有这个函数不能用,而且它里面调用了很多其他类的方法吧?自己写的话,真不会=。=...
回复

使用道具 举报

千问 | 2011-9-28 16:48:56 | 显示全部楼层
Random r = new Random();
return r.Next(1, 10);...
回复

使用道具 举报

千问 | 2011-9-28 16:48:56 | 显示全部楼层
用http://yushuir.blog.163.com/blog/static/434671382010111492948409/的代码,循环5次,范围为1-10,呵呵。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行