求一算法 group:123,asvalue:1,2,3,a,spname:123,123,123,as,as输出1,a1,s2,a2,s3,a3,s 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个? string str = "123,as"; string[] ss = str.Split(','); for (int i = 0; i < ss[0].Length; i++) { for (int j = 0; j < ss[1].Length; j++) { Console.WriteLine(ss[0][i] + "," + ss[1][j]); } } string str = "123,as"; string[] ss = str.Split(','); for (int i = 0; i < ss[0].Length; i++) { for (int j = 0; j < ss[1].Length; j++) { Console.WriteLine(ss[0][i] + "," + ss[1][j]); } } 不知道怎么表达第一组是不固定的 只是个名字和第二组里的值没关系,也可能是:CSDN,ASP.NET1,2,3,a,sCSDN,CSDN,CSDN,ASP.NET,ASP.NET第三组数量上与第二组对应,值是标明属于哪组。 输出1,a1,s2,a2,s3,a3,s不懂 头大...数字组,字母组1,2,3,a,b数字组,数字组,数字组,字母组,字母组只是对第二组数据排列输出1,a1,b2,a2,b3,a3,b WOCA 为了下载个资料 还要注册先赚积分 老子下完就走人!! 不是。123,as只是个假设数字组,字母组...1,2,3,a,b...数字组,数字组,数字组,字母组,字母组...都是不定项的行1和行2没有直接关系 行2数量和行3一一对应 行3值标识行2值所在行1的组 我认为已经说的比较清楚了啊已知数字组,字母组1,2,3,a,b数字组,数字组,数字组,字母组,字母组求1,a1,b2,a2,b3,a3,b 老大,你这样表达很难看懂,你看我的:有两种动物: 马种 ,驴种混杂在一起了: 马A,马B,驴A,驴B,马B我们对应上面的顺序得出种类:马,马,驴,驴,马求交配生下骡子的方式.......马A :驴A马A :驴B //解法:class 动物{ public string 名称; public string 种类; public void 动物(string name,string type) { 名称 = name; 种类 = type; }}//原来的三个数组变两个了//for赋值不写了动物[i] = new 动物("马1","马");//再来个FOR比较注意,排列的话会有:"马1:驴1" 和 "驴1 :马1"的情况//应该考虑组合只要判断 动物[i].种类 是否相等即可 用麻烦的办法解决了还是谢谢LS各位List<List<string>> listGroup = new List<List<string>>();List<List<string>> datas = new List<List<string>>();string[] AttributeName = Request.Form["AttributeName"].Split(','); string[] AttributeValue = Request.Form["AttributeValue"].Split(','); string[] ParentName = Request.Form["ParentName"].Split(','); for (int i = 0; i < AttributeName.Length; i++) { List<string> strList = new List<string>(); string strAdd = string.Empty; for (int j = 0; j < AttributeValue.Length; j++) { if(AttributeName[i]==ParentName[j]) { strAdd = AttributeValue[j]; strList.Add(strAdd); } } datas.Add(strList); }List<Model.Goods_Assemble> AssembleList = new List<Model.Goods_Assemble>(); foreach (List<string> strTemp in listGroup) { Model.Goods_Assemble AssembleModel = new Model.Goods_Assemble(); string strTime = DateTime.Now.ToString("hhmmssffff"); AssembleModel.Number = "G" + strTime + ran.Next(1000, 9999).ToString(); AssembleModel.Stock = Convert.ToInt32(DefaultStock.Text); string tempValue = string.Empty; foreach (string str in strTemp) { tempValue += str + ","; } AssembleModel.AssembleValue = tempValue.TrimEnd(','); AssembleList.Add(AssembleModel); private void GetItem(int Index, List<string> Result) { if (Index > datas.Count - 1) { listGroup.Add(new List<string>(Result)); return; } for (int i = 0; i < datas[Index].Count; i++) { Result.Add(datas[Index][i]); GetItem(Index + 1, Result); Result.RemoveAt(Result.Count - 1); } } } 关于保留数据修改痕迹(数据存档问题) asp.net 发布时,提示同一依赖程序集的不同版本之间出现冲突?求解决之道。 自定义工作流 中间件,急求~~~~~~~ aspx窗口关闭的问题 谁能帮我做几张动态网页啊,急死我啦!!! 关于asp.net中自定义查询组合的控件 急~~ 高分求PowerTCP Sockets for .NET 的注册码 实在不明白哪儿的错? SELECT语句问题 datagrid的Datasource能否为Dataset中的不同数据表呢?(同时是2个以上) 文字编辑器IE6与IE8兼容性怎么解决 马上结贴:一个IP只能修改数据库一次
string[] ss = str.Split(','); for (int i = 0; i < ss[0].Length; i++)
{
for (int j = 0; j < ss[1].Length; j++)
{
Console.WriteLine(ss[0][i] + "," + ss[1][j]);
}
}
string[] ss = str.Split(','); for (int i = 0; i < ss[0].Length; i++)
{
for (int j = 0; j < ss[1].Length; j++)
{
Console.WriteLine(ss[0][i] + "," + ss[1][j]);
}
}
第一组是不固定的 只是个名字和第二组里的值没关系,
也可能是:
CSDN,ASP.NET
1,2,3,a,s
CSDN,CSDN,CSDN,ASP.NET,ASP.NET
第三组数量上与第二组对应,值是标明属于哪组。
1,a
1,s
2,a
2,s
3,a
3,s
不懂
数字组,字母组
1,2,3,a,b
数字组,数字组,数字组,字母组,字母组
只是对第二组数据排列输出
1,a
1,b
2,a
2,b
3,a
3,b
123,as
只是个假设数字组,字母组...
1,2,3,a,b...
数字组,数字组,数字组,字母组,字母组...
都是不定项的
行1和行2没有直接关系 行2数量和行3一一对应 行3值标识行2值所在行1的组
已知
数字组,字母组
1,2,3,a,b
数字组,数字组,数字组,字母组,字母组
求
1,a
1,b
2,a
2,b
3,a
3,b
混杂在一起了: 马A,马B,驴A,驴B,马B
我们对应上面的顺序得出种类:马,马,驴,驴,马求交配生下骡子的方式.......
马A :驴A
马A :驴B
class 动物
{
public string 名称;
public string 种类;
public void 动物(string name,string type)
{
名称 = name;
种类 = type;
}
}
//原来的三个数组变两个了
//for赋值不写了
动物[i] = new 动物("马1","马");//再来个FOR比较注意,排列的话会有:"马1:驴1" 和 "驴1 :马1"的情况
//应该考虑组合只要判断 动物[i].种类 是否相等即可
List<List<string>> datas = new List<List<string>>();string[] AttributeName = Request.Form["AttributeName"].Split(',');
string[] AttributeValue = Request.Form["AttributeValue"].Split(',');
string[] ParentName = Request.Form["ParentName"].Split(','); for (int i = 0; i < AttributeName.Length; i++)
{
List<string> strList = new List<string>();
string strAdd = string.Empty;
for (int j = 0; j < AttributeValue.Length; j++)
{
if(AttributeName[i]==ParentName[j])
{
strAdd = AttributeValue[j];
strList.Add(strAdd);
}
}
datas.Add(strList);
}List<Model.Goods_Assemble> AssembleList = new List<Model.Goods_Assemble>();
foreach (List<string> strTemp in listGroup)
{
Model.Goods_Assemble AssembleModel = new Model.Goods_Assemble();
string strTime = DateTime.Now.ToString("hhmmssffff");
AssembleModel.Number = "G" + strTime + ran.Next(1000, 9999).ToString();
AssembleModel.Stock = Convert.ToInt32(DefaultStock.Text);
string tempValue = string.Empty;
foreach (string str in strTemp)
{
tempValue += str + ",";
}
AssembleModel.AssembleValue = tempValue.TrimEnd(',');
AssembleList.Add(AssembleModel);
private void GetItem(int Index, List<string> Result)
{
if (Index > datas.Count - 1)
{
listGroup.Add(new List<string>(Result));
return;
}
for (int i = 0; i < datas[Index].Count; i++)
{
Result.Add(datas[Index][i]);
GetItem(Index + 1, Result);
Result.RemoveAt(Result.Count - 1);
}
} }