在VC++6.0中定义一个二维数组

来源:百度知道 编辑:UC知道 时间:2024/05/16 10:40:49
我定义了一个二维数组
const int M = 100;
int Tree[6][6]={{0,2,3,4,M,8},{2,0,6,M,4,7},{6,0,4,M,M},{4,M,4,0,M,9},{M,4,M,M,0,5},{8,7,M,9,5,0}};
可是编译不正确:
error C2059: syntax error : '{'
error C2143: syntax error : missing ';' before '{'
等等,不知道是什么问题?
请高手请教.
int MinSpanTree_Prim(int n,int **d,int T[][2])
{
int Closest[5];//save the node which closest the node "j" in the T(V);
int Visited[5];//save the node whethe be visited;
int Lowcost[5];//Lowcos[j] = d[j][Closest[j]];
int g=0; //weight;

for(int i = 0; i < n; i++)
{
int min = Infinity;

for(int j = 0,k = 0; k < n; k++)//chioce the node closest the current T(V);
{
if((Lowcost[k] < min) && (!Visited[k]))
{
min = Lowcost[k];
j = k;
}
}

T[i] = {j,Closest[j]}; // add the edge int T(V);

#include<stdio.h>
main()
{
const int M = 100;
int Tree[6][6]={{0,2,3,4,M,8},{2,0,6,M,4,7},{6,0,4,M,M},{4,M,4,0,M,9},{M,4,M,M,0,5},{8,7,M,9,5,0}};
}
我先打这些上去试了一下..怎么不会报错呢..你再检查一下吧..仔细点..慢慢调试嘛

你的代码在我的VC++6.0中就可以通过啊。
你是不是除了这两行代码还有其他代码啊。
大概是其他代码的问题。一起粘出来