如何使用锯齿状阵列收集信息? [英] How to collect information with a jagged array?

查看:65
本文介绍了如何使用锯齿状阵列收集信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello. I am a new guy to C# (going for a master degree), so my teacher jumped streight to giving us homework. So, what I need to do is : to collect data about student's marks using jagged arrays.

1st: we must introduce data about the list of courses using a vector....

2nd: we must introduce data about the list of students using a vector...

3rd: we must generate a random irregulated parallelepiped using the marks of each student at each course...

Frankly, I have no ideea how to do this and my teacher isn't helping me either, he's not explaining very well, can you help me?





我的尝试:





What I have tried:

string [][][] stud = new string[4][5][8];





这就是我能想到的......



That's all I could come up with...

推荐答案

锯齿状数组是一个n维数组的数组< br $> b $ b

Jagged array is an array of n-dimensional arrays

'a one dimensional array accepts no arrays, simply objects



Dim oneDArray()As Integer = {4,5,8}




Dim oneDArray() As Integer = {4, 5, 8}

'a two dimensional array accepts only arrays and that of one dimensional



Dim twoDArray()()As Integer = {oneDArray,anotherOneDArray,etc1 ..}



Dim threeDArray()()()As Integer = {twoDArray,anotherTwoDArray,etc2 ......,another_etc2 ....}





threeDArray(0)返回twoDArray

threeDArray(1)返回anotherTwoDArray

threeDArray(2)返回etc2 ......

threeDArray(3)返回another_etc2 ...



threeDArray(0)(0)返回oneDArray

threeDArray(0)(0) (0)返回4.(见上文{4,5,8})


Dim twoDArray()() As Integer = {oneDArray, anotherOneDArray, etc1..}

Dim threeDArray()()() As Integer = {twoDArray, anotherTwoDArray, etc2..., another_etc2....}


threeDArray(0) returns twoDArray
threeDArray(1) returns anotherTwoDArray
threeDArray(2) returns etc2...
threeDArray(3) returns another_etc2...

threeDArray(0)(0) returns oneDArray
threeDArray(0)(0)(0) returns 4. (see above {4,5,8})


这篇关于如何使用锯齿状阵列收集信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆