这个迭代算法哪儿错了~
//[bo]YACOBI迭代算法解线性方程组的算法[/bo]~~#include <iostream.h>
#include <math.h>
#include <stdio.h>
#define n 4;
void main()
{
double a[4][4]={{8,7,0,0},{6,12,5,0},{0,4,9,3},{0,0,1,2}};
double b[4]={0,-2,8,6};
double e=0.5/pow(10,5);
double x[4]={0,0,0,0};
double y[4];
double ymax=0;
do
{ double ymax=0;
for(int i=0;i<n;i++)
{double s=0;
for(int j=0;j<n;j++)
{ if (j!=i)
{s+=a[i][j]*x[j];}
}
y[i]=(b[i]-s)/a[i][i];
if (ymax<fabs(y[i]-x[i]))
ymax=fabs(y[i]-x[i]);
}
for(j=0;j<n;j++)
{x[j]=y[j];}
}while(ymax>e);
cout<<"The roots are: \n";
for(int j=0;j<n;j++);
{printf("x[%d]=%e",j+1,x[j]);
printf("\n");}
}