我有下面的代码来翻译成vb,我想知道这些括号是什么意思。int cost[N][N]和bool S[N]有什么不同
#define N 55 //max number of vertices in one part
#define INF 100000000 //just infinity
int cost[N][N]; //cost matrix
int n, max_match; //n workers and n jobs
int lx[N], ly[N]; //labels of X and Y parts发布于 2013-10-06 02:01:56
costN和bool SN有什么区别?
它们是两种不同类型的数组。
cost[N][N]是大小为NxN的二维整数数组,而bool[N]是大小为N的一维数组。
visual basic转换
int cost[N][N]; ==> Dim cost(N-1,N-1) As Integer
int s[N]; ==> Dim s(N-1) As Integer请参阅VB tutorial
发布于 2013-10-06 02:29:09
第一个问题的答案是:
cost[N][N]是一个二维数组,而bool S[N]是一个一维数组。现在你可以从这里读到什么维数组:
http://en.wikipedia.org/wiki/Array_data_structure#One-dimensional_arrays
关于你的第二个问题
int cost[N][N];等同于:
Dim cost(N-1, N-1) As Integer在VB中
https://stackoverflow.com/questions/19200936
复制相似问题