?? yiwei_shen.cpp
字號:
/***********全主元消去法**********************/
#include<iostream.h>
#include<math.h>
#define size 3
double G_S[size][size+1],x[size+1];
void main()
{
int fagx=0,fagy=0,i,j,k=3;
cout.setf(ios::fixed);
cout.precision(4);
cout<<"Please input datas:\n";
for(i=0;i<size;i++)
for(j=0;j<size+1;j++)
cin>>G_S[i][j];
for(int A=0;A<3;A++)
for(int B=0;B<4;B++)
{
cout<<"G_S["<<A<<"]["<<B<<"]="<<G_S[A][B]<<" ";
if(B==3)cout<<'\n';
}
for(i=0;i<3;i++)//i表示行數
{
for(int I=0;I<4;I++)
for(j=0;j<4;j++)
if(fabs(G_S[I][j])>fabs(G_S[fagx][fagy]))
{fagx=I;fagy=j;}
for(j=0;j<4;j++)
G_S[fagx][j]/=G_S[fagx][fagy];//hang chu
for(I=0;I<3;I++)
if(I!=fagx)
{
for(j=0;j<4;j++)
if(G_S[I][fagy]!=0)
G_S[I][j]+=G_S[fagx][j]*fabs(G_S[I][fagy]);
}
}
for(int A1=0;A1<3;A1++)
for(int B1=0;B1<4;B1++)
{
cout<<"G_S["<<A1<<"]["<<B1<<"]="<<G_S[A1][B1]<<" ";
if(B1==3)cout<<'\n';
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -