并且这里有一个问题,
大神们可以教教我如何调用方法 如何正确定义吗?
using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace 数组_结构体{ class Program {
public static int input (int [,] a ) { int i=0; int j=0; Console.WriteLine( "Please input the hang"); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please input the lie "); int m = Convert.ToInt32(Console.ReadLine()); int [,] b = new int [n,m]; for ( i=0;i<n;i++) { for ( j=0; j < m; j++) { Console.WriteLine("请输入第{0}行,第{1}列的元素", i, j); b[i, j] = Convert.ToInt32(Console.ReadLine()); } } return b[i,j]; }
static void Main(string[] args) { int a=0 ; int b=0; int [,]j= new int [a,b]; int l1; ; l1= input(j ); } }}
完全不知道你想 干什么。。
这是啥代码。。。
===============
public static int[,] input()。。。通过方法实现 二维数组的输入 NM 分别定义几行几列
追答已经改好啦。。