遍历多维数组
2015-08-11 09:37
435 查看
usingSystem.Threading; namespaceConsoleApplication1 { classProgram { staticvoidMain(string[]args) { Console.Write("输入个数:"); intA=int.Parse(Console.ReadLine()); int[]x=newint[A]; inta=x.Length; Console.Write("输入个数:"); intB=int.Parse(Console.ReadLine()); int[]y=newint[B]; intb=y.Length; Console.Write("输入个数:"); intC=int.Parse(Console.ReadLine()); int[]z=newint[C]; intc=z.Length; int[,,]sza=newint[A,B,C]; for(inti=0;i<a;i++) { for(intj=0;j<b;j++) { for(intk=0;k<c;k++) { Thread.Sleep(500); Randomr=newRandom(); sza[i,j,k]=r.Next(1,99); Console.Write(sza[i,j,k]+""); } } } Console.WriteLine(); foreach(intminsza)//遍历数组或其他集合 { Console.Write(""+m); } intl=sza.Length; Console.WriteLine("\n数组总字符数"+l); Console.ReadLine(); } } }
相关文章推荐
- Air Raid
- Cocos2d-x学习笔记(十)—— 缓存机制
- 如何更新RHEV平台的GUEST代理和驱动
- ios 单例模式的写法
- 17-集合框架-15-常用对象API(集合框架-ArrayList集合存储自定对象)
- Select2插件 IE下 autofocus bug的解决方法
- SQL技巧之分组求和
- error LNK2019: 无法解析的外部符号 _cvHaarDetectObjects,该符号在函数 "void __cdecl detect_and_draw(struct _IplImage
- pyinstaller 打包时出现No Module Named pkg_resources
- 在B获取A的数据——深入浅出讲ContentProvider
- Calendar Date SimpleDateFormat (2)
- 通知中心
- INIT_WORK
- hdu 1501 Zipper 拉链
- 已经使用一段时间了,某次启动eclipse时后突然报错eclipse java was started but returned code=1
- 数据结构-----线段树(一)
- 图像处理之qt实现
- jQuery模仿window7窗口弹出效果
- 17-集合框架-14-常用对象API(集合框架-LinkedList集合-练习(堆栈和队列))
- 推断数据对象的存在