我写了一个程序,运行错误。请大家看看哪儿错了!
#include<stdio.h>#define N 8
#define I 9999
int L[N][N]={
{0,4,6,I,I,I,I,I},
{I,0,I,5,4,I,I,I},
{I,I,0,4,7,I,I,I},
{I,I,I,0,I,9,7,I},
{I,I,I,I,0,5,6,I},
{I,I,I,I,I,0,5,4},
{I,I,I,I,I,I,0,1},
{I,I,I,I,I,I,I,0}};
int min(a,b)
{
int x;
x=a<b? a:b;
return(x);
}
void main()
{
int min(int a,int b);
int P[N];
int T[N]={I,I,I,I,I,I,I,I};
int a,b,c,i,j;
P[0]=0;
for(i=1,i<N,i++)
{
P[i]=I;
for(j=0,j<i,j++)
{
a=T[j];
b=P[i-1]+L[i][j];
T[j]=min(a,b);
}
for(j=0,j<i,j++)
{
c=P[i];
P[i]=min(c,T[j]);
}
}
printf("%d",P[7]);
}
--------------------Configuration: zdlj - Win32 Debug--------------------
Compiling...
zdlj.c
D:\c程序\zdlj.c(27) : error C2143: syntax error : missing ';' before ')'
D:\c程序\zdlj.c(27) : error C2143: syntax error : missing ';' before ')'
D:\c程序\zdlj.c(30) : error C2143: syntax error : missing ';' before ')'
D:\c程序\zdlj.c(30) : error C2143: syntax error : missing ';' before ')'
D:\c程序\zdlj.c(36) : error C2143: syntax error : missing ';' before ')'
D:\c程序\zdlj.c(36) : error C2143: syntax error : missing ';' before ')'
执行 cl.exe 时出错.
zdlj.exe - 1 error(s), 0 warning(s)