- #1

- 96

- 0

The first question I have is how would I swap rows? I know its probably really simple but I cannot find and source code that might provide some insight. Could anyone please take a look at the following code and give me some insights. Thanks in advance

This is just what I have so far.

Code:

```
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x[50],a[50][50],c[50],d[50][50],max,loc;
int i,j,n,ai;
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";
}
//looks for the pivot
max <= a[0][0];
loc <= 0;
for (i=1;i<=n;i++)
{
if (a[i][0] > max);
{
max <= a[i][0];
loc <= i;
}
}
system("pause");
return 0;
}
```