小问题.^-^ public string zxlu,lxlr,sjbs,xxcx,rzck,xxts;string a='1,2,5'如何循环赋值:zxlu="-" lxlr="-" rzck="-" 其它为:sjbs="." xxcx="." xxts="." 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 What do you want to do? zxlu=lxlr=rzck="-".sjbs=xxcx=xxts=".". lz要怎么循环? 问题是这样的啊.public string zxlu,lxlr,sjbs,xxcx,rzck,xxts;string a='1,2,5'zxlu 对应 1 如果有对应关系 zxlu="-" lxlr 对应 2 .............. lxlr="-" sjbs 对应 3 如果没有对应关系 sjbs="."xxcx 对应 4 如果没有对应关系 xxcx="."rzck 对应 5 如果有对应关系 rzck="-" xxts 对应 6 如果没有对应关系 xxts="."大家明白没?? 我看大家有没有特别奇特的方法来解决这个循环问题??? 如果 zxlu,lxlr,sjbs,xxcx,rzck,xxts 这些是固定的就这么几个,不用循环了,好像也没有什么可循环的,循环是要有条件的 楼上的,我的string a='1,2,5' 可是个变化的值啊.我不知道它下次是多少啊??不循环咋整?? string a='1,2,5' 变化有规律吗,比如递增还是递减,步长多少 string a='1,2,5' 下次可能是:string a='1,3,5'..string a='6,2,5'没啥规律,但和zxlu,lxlr,sjbs,xxcx,rzck,xxts 有对应关系....所以要用循环,我现在处理方法比较土IndexOf("6",0)>=0 表示这个变量中含"6" ,那么 xxts="-" 判断了6次.我看有没有比较简单的方式处理这个问题...谢谢楼上的. 不说别的,这句:string a='1,2,5'能编译通过吗....... 好像是指 a 中含有指定字符,则zxlu="-" lxlr="-" rzck="-" 否则sjbs="." xxcx="." xxts="." a中字符可能取值为(1-6)中的任3个.不知道LZ目的是什么? zxlu="-" lxlr="-" rzck="-" sjbs="." xxcx="." xxts="." 应该定义为一个数组!! 回复人:iloveyoujia(每天一个故事) ( ) 信誉:100 2007-01-07 10:54:47 得分:0? string a='1,2,5';---------------------------我指的不是你没加分号......这是加了分号后csc的信息:error CS1012: 字符文本中的字符太多 using System;using System.Collections.Generic;using System.Text;using System.Collections;using System.IO;namespace Con070107{ class Program { static void Main(string[] args) { string a = "1,2,5";//a可以变化; String [] aa=new string[6];/*zxlu="-" lxlr="-" rzck="-" sjbs="." xxcx="." xxts="." 应该定义为一个数组!! */for(int i=1 ;i<=6;i++){ if (a.IndexOf(i.ToString()) >=0) aa[i-1] = "-"; else aa[i-1] = ".";}for (int i = 0; i <= 5; i++){ System.Console.WriteLine(aa[i]);} } }}以上已测试通过!!} using System;using System.Collections.Generic;using System.Text;using System.Collections;using System.IO;namespace Con070107{ class Program { static void Main(string[] args) { string a = "1,2,5";//a可以变化; String [] aa=new string[6];/*zxlu="-" lxlr="-" rzck="-" sjbs="." xxcx="." xxts="." 应该定义为一个数组!! */for(int i=1 ;i<=6;i++){ if (a.IndexOf(i.ToString()) >=0) aa[i-1] = "-"; else aa[i-1] = ".";}for (int i = 0; i <= 5; i++){ System.Console.WriteLine(aa[i]);} } }}}以上已测试通过!! 问题给你解决了,帮我顶一下这个贴:http://community.csdn.net/Expert/topic/5277/5277704.xmlhttp://community.csdn.net/Expert/topic/5277/5277704.xml?temp=.7580377 再加上:zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2] sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5];就OK!! using System;using System.Collections.Generic;using System.Text;using System.Collections;using System.IO;namespace Con070107{ class Program { static void Main(string[] args) { string a = "1,2,5";//a可以变化; String [] aa=new string[6];/*zxlu="-" lxlr="-" rzck="-" sjbs="." xxcx="." xxts="." 应该定义为一个数组!! */for(int i=1 ;i<=6;i++){ if (a.IndexOf(i.ToString()) >=0) aa[i-1] = "-"; else aa[i-1] = ".";}/* for (int i = 0; i <= 5; i++){ System.Console.WriteLine(aa[i]);} */zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2] sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5]; } }}}以上已测试通过!! using System;using System.Collections.Generic;using System.Text;using System.Collections;using System.IO;namespace Con070107{ class Program { static void Main(string[] args) { string a = "1,2,5";//a可以变化; String [] aa=new string[6];/*zxlu="-" lxlr="-" rzck="-" sjbs="." xxcx="." xxts="." 应该定义为一个数组!! */for(int i=1 ;i<=6;i++){ if (a.IndexOf(i.ToString()) >=0) aa[i-1] = "-"; else aa[i-1] = ".";}/* for (int i = 0; i <= 5; i++){ System.Console.WriteLine(aa[i]);} */zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2] ;sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5]; } }}}以上已测试通过!! 【简单问题】应该如何向网站Post数据 请教下怎么保证多个步骤的一致性,事务性 怎么设置开机启动???并且在启动项里看不到 数据库链接的问题 File 的关闭 C# 数据结构算法 一个问题不明白......... *散分* 数据挖掘:本人想涉猎对无线网络传输的数据进行分析归类,盼高人指导工作 :) 一般什么情况下会用到接口 高手帮我看一下这个,问什么说“集合已修改;枚举操作可能无法执行”? C# 类与结构的疑问
sjbs=xxcx=xxts=".". lz要怎么循环?
public string zxlu,lxlr,sjbs,xxcx,rzck,xxts;string a='1,2,5'
zxlu 对应 1 如果有对应关系 zxlu="-"
lxlr 对应 2 .............. lxlr="-"
sjbs 对应 3 如果没有对应关系 sjbs="."
xxcx 对应 4 如果没有对应关系 xxcx="."
rzck 对应 5 如果有对应关系 rzck="-"
xxts 对应 6 如果没有对应关系 xxts="."大家明白没?? 我看大家有没有特别奇特的方法来解决这个循环问题???
string a='1,3,5'
..
string a='6,2,5'没啥规律,但和zxlu,lxlr,sjbs,xxcx,rzck,xxts 有对应关系....所以要用循环,我现在处理方法比较土IndexOf("6",0)>=0 表示这个变量中含"6" ,那么 xxts="-" 判断了6次.我看有没有比较简单的方式处理这个问题...谢谢楼上的.
string a='1,2,5'
能编译通过吗.......
否则sjbs="." xxcx="." xxts="."
a中字符可能取值为(1-6)中的任3个.不知道LZ目的是什么?
sjbs="." xxcx="." xxts="."
应该定义为一个数组!!
? string a='1,2,5';
---------------------------
我指的不是你没加分号......
这是加了分号后csc的信息:
error CS1012: 字符文本中的字符太多
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;
namespace Con070107
{
class Program
{
static void Main(string[] args)
{
string a = "1,2,5";//a可以变化;
String [] aa=new string[6];
/*zxlu="-" lxlr="-" rzck="-"
sjbs="." xxcx="." xxts="."
应该定义为一个数组!! */for(int i=1 ;i<=6;i++)
{
if (a.IndexOf(i.ToString()) >=0)
aa[i-1] = "-";
else
aa[i-1] = ".";
}
for (int i = 0; i <= 5; i++)
{
System.Console.WriteLine(aa[i]);
}
}
}
}
以上已测试通过!!}
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;
namespace Con070107
{
class Program
{
static void Main(string[] args)
{
string a = "1,2,5";//a可以变化;
String [] aa=new string[6];
/*zxlu="-" lxlr="-" rzck="-"
sjbs="." xxcx="." xxts="."
应该定义为一个数组!! */for(int i=1 ;i<=6;i++)
{
if (a.IndexOf(i.ToString()) >=0)
aa[i-1] = "-";
else
aa[i-1] = ".";
}
for (int i = 0; i <= 5; i++)
{
System.Console.WriteLine(aa[i]);
}
}
}
}}
以上已测试通过!!
http://community.csdn.net/Expert/topic/5277/5277704.xml
http://community.csdn.net/Expert/topic/5277/5277704.xml?temp=.7580377
zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2]
sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5];就OK!!
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;
namespace Con070107
{
class Program
{
static void Main(string[] args)
{
string a = "1,2,5";//a可以变化;
String [] aa=new string[6];
/*zxlu="-" lxlr="-" rzck="-"
sjbs="." xxcx="." xxts="."
应该定义为一个数组!! */for(int i=1 ;i<=6;i++)
{
if (a.IndexOf(i.ToString()) >=0)
aa[i-1] = "-";
else
aa[i-1] = ".";
}
/* for (int i = 0; i <= 5; i++)
{
System.Console.WriteLine(aa[i]);
} */
zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2]
sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5]; }
}
}}
以上已测试通过!!
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;
namespace Con070107
{
class Program
{
static void Main(string[] args)
{
string a = "1,2,5";//a可以变化;
String [] aa=new string[6];
/*zxlu="-" lxlr="-" rzck="-"
sjbs="." xxcx="." xxts="."
应该定义为一个数组!! */for(int i=1 ;i<=6;i++)
{
if (a.IndexOf(i.ToString()) >=0)
aa[i-1] = "-";
else
aa[i-1] = ".";
}
/* for (int i = 0; i <= 5; i++)
{
System.Console.WriteLine(aa[i]);
} */
zxlu=aa[0]; lxlr=aa[1]; rzck=aa[2] ;
sjbs=aa[3]; xxcx=aa[4]; xxts=aa[5]; }
}
}}
以上已测试通过!!