用C#语言编程,如何从键盘输入一个数组?
键盘输入12,23,34,45,即字符串以逗号分隔,用split方法拆分为数据,帮助中有例子,简单修改即可。
建立数组,如只有26个字母,则维数26,循环字符串,用switch判断第几个字母,并在对应的数据中加1,显示时,为0的数组数据不显示,显示的第几维,则字母就是第几个。
如果是中文判断,要使用动态数据arraylist。
C#数组有4种写法
ArrI=new Array();
ArrI[0] = new Array("username1","0","609");
ArrI[1] = new Array("username2","609","610");
ArrI[2] = new Array("username3","609","611");
ArrII=new Array();
new Array("username1","0","609"),
new Array("username2","609","610"),
new Array("username3","609","611")
ArrIII=[];
ArrIII[0] = new Array("username1","0","609");
ArrIII[1] = new Array("username2","609","610");
ArrIII[2] = new Array("username3","609","611");
ArrIIII=[];
["username1","0","609"],
["username2","609","610"],
["username3","609","611"]