http://www.scs.carleton.ca/~wli/2404...Assign1W09.doc
In the first part the procedure that I followed is as follows. Is it in accordance with the requirements.
Code:class Main { public: Main(void); ~Main(void); void main(){ double a[100][100], b[100][100], d[100][100], c[100], e[100], maxele, temp; cout<<" Please enter the number of unknowns: "; for(int i=0; i<n; i++){ for(int j=0; j<n; j++) cin>>a[i][j]; } for(int i=0; i<n; i++){ cin>>c[i]; } for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(a[i][j]<0){ b[i][j]=-1*a[i][j]; } else{ b[i][j]=a[i][j]; } } } int k=0; for(int i=0; i<n; i++){ k<--i; while(j<n){ if(a[i][j]>a[i][k]){ temp<--a[i][k]; a[i][k]<--a[i][j]; a[i][j]<--temp; maxele<--a[i][k]; j++; k++; } } } for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ d[i][j]<--a[i][j]/a[i][1]; } } for(int i=0; i<n; i++){ if(a[i][1]<a[++i][1]){ for(int j=0; j<n; j++){ a[i][j]<--a[++i][j]; } } } for(int i=0; i<n; i++){ if(a[i][i]<1 && a[i][i]>1E-9){ cout<<"the system does not have a unique solution"; break; } else{ for(int j=0; j<n; j++){ a[i][j]<--a[i][j]-d[i][j]; } } } break; } static const int i=50; static const int j=50; while(i>0) do{ while(j>0) do{ if(a[i][j]<1 && a[i][j]>1E-9){ break; } else{ e[i]=(b[i]-a[i][--j])/a[i][j]; } } } /*for(int i=sizeof a; i>0; i--){ for(int j=sizeof a; j>0; j--){ if(a[i][j]<1 && a[i][j]>1E-9){ break; } else{ e[i]=(b[i]-a[i][--j])/a[i][j]; } } }*/ } private: };