开发者

I want to form a m x n matrix by giving some numbers as input in c#

开发者 https://www.devze.com 2023-01-01 03:52 出处:网络
HI, suppose i have given input numbers 开发者_如何学JAVAlike this 1,2,3,4,5,6,7,8,9,0 i should form it as 3 x 3 matrix but my input has 10 elements how to form a matrix

HI,

suppose i have given input numbers 开发者_如何学JAVAlike this 1,2,3,4,5,6,7,8,9,0

i should form it as 3 x 3 matrix but my input has 10 elements how to form a matrix for such input in c#


try this

int[] arr = new int[3 + 1/3, 3]


How do you fit ten elements into nine variables? You don't.

You're asking an impossible question. I'm sure someone will come up with some absurd hack that lets you do this, but that doesn't make it sensible to store data this way.

Use a larger array, or store fewer values.

0

精彩评论

暂无评论...
验证码 换一张
取 消