我作业有问题,想找人帮忙
I have to read a text file into a 2D int array. The width of the 2D array is fixed at 5 and will never change. However, the height of the array may change depend on the length of the text file.
我必须从一个 40x5 矩阵开始; 超过 40 行的任何文件都无法接受, 但少于 40 则可以 。 因此, 我可能会只得到我数组中的 X 行被填充( X & lt;= 40 ) 。
I have to calculate the average of each column, so I need to how many elements in a column; Is there any way to get that? Or can I change the size of my original array (with all the data in it) to Xx5 after I know what X is?
样本输入文件 :
034 080 055 078 045 060 100 056 078 078 070 010 066 078 056 034 009 077 078 020 045 040 088 078 055
产出应当是:
48.6 47.8 68.4 78.0 50.8