Home > database >  N linear equations of the code, c language, for a great god and see where is wrong
N linear equations of the code, c language, for a great god and see where is wrong

Time:11-18

# include

using namespace std;

Void main ()

{

Int I=0, j=0, k, n, sum=0;

Cout<& lt;" Enter the number of unknowns, ";

Cin> n;

A=new double double * * * (n + 1),

for(i=0; i<=n; I++)

{

A [I]=new double [n + 1);

}

Double * b=new double [n + 1);

Cout<& lt;" Each line input of the coefficient matrix of linear equations and the equal sign on the right side of the: "& lt;
for(i=1; i<=n; I++)

{

For (j=1; j<=n; J++)

{

Cin> A, [I] [j].

}

Cin> B [I];

}

K=1;

While (1)

{

For (I=k + 1; i<=n; I++)

{

A [I] [k]=[I] a [k]/a, [k] [k].

}

For (I=k + 1; i<=n; I++)

{

For (j=k + 1; j<=n; J++)

{

A [I] [j]=[I] a [j] - [I] a [k] * a, [k] [j].

}

B=b [I] - [I] a [I] [k] * b [k].

}

If (k! K++=(n - 1));

The else break;

}

B [n] [n]=b/a, [n] [n].

For (I=n - 1; I>=1; I -)

{

For (j=I + 1; j<=n; J++)

{

B -=[I] a [I] [j] * b [j];

}

[I] b=(1/a [I] [I]) * b [I];

Sum=0;

}

for(i=1; i<=n; I++)

{

Cout<& lt;" X "& lt;
  • Related