I just had a question about a project I am working on. I am supposed to design a program that will solve up to fifty simultaneous equations using gauss jordan.

I just was wondering what would be the best way to find the "PIVOT"(the largest absolute value number in the first column). Once you have found the "pivot" I then need to interchange that row with row 1. Any suggestions?

I just was wondering what would be the best way to find the "PIVOT"(the largest absolute value number in the first column). Once you have found the "pivot" I then need to interchange that row with row 1. Any suggestions?

Code:

#include<iostream> using namespace std; int main() { double x[50],a[50][50],c[50]; int i,j,n; cout <<"\n\nPlease enter the number of rows/variables\n"; cin >> n; cout<<"\nLet's now enter the row and column values\n"<<endl; cout<<endl; for (i=1;i<=n;i++) { for (j=1;j<=n;j++) { cout <<"Row "<<i<<", Column "<<j<<"\n"; cin >> a[i][j]; } cout << "Please enter the constant for row "<<i<<"\n"; cin >> c[i]; } cout <<"\n\nThe matrix entered is as follows:\n"; for (i=1;i<=n;i++) { cout<<"\n"; for (j=1;j<=n;j++) { cout <<a[i][j]<<"\t"; } cout<<" ="<<c[i]<<"\n"; } system("pause"); return 0; }