solver for AX=B by gauss elimination

i need a program to solve AX=B by gauss elimination.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

deluxeConnect With a Mentor Commented:
try teacher made me do it..and here it is..just..make it dynamic array..

#include "stdafx.h"
#include "iostream.h"
#include "iomanip.h"
#include "math.h"

int main() {
  int lngth;
  cout << "Size of matrix:\n";
  cin >> lngth;
  if (lngth>10) return 0;
    double a[10][10], b[10], x,      y, z[10];
    for (int ix=0; ix<=lngth-1; ix++) {
      for (int iy=0; iy<=lngth-1; iy++) {
      cout << "Term of "<< ix+1 << "x" << iy+1 << ":";
      cin >> a[iy][ix];
    cout << "Please enter solution for this equation" << ":";
    cin >> b[ix];
  for (int u=0; u<=lngth-1; u++) {                        
    for (int v=0; v<=lngth-1; v++) {                    
      if (a[u][v]!=0) {                                                
      if (double(a[u][v])!=1) {                              
        cout << setw(3) <<a[u][v];                        
      } else {                                                      
        cout << setw(3) << " ";                              
      cout << char('a'+v);                                    
      if (v!=lngth-1) {
        cout << " +";                                          
      } else {                                                            
      cout << setw(6) << " ";                                    
  cout << "\t = " << b[u];                                          
  cout << '\n';                                                            

      for (int i=0; i<=lngth-1; i++) {                        
            for (int j=0; j<=lngth-1; j++){                                    
                  if (x==0) {
                        for (int h=0; h<=lngth-1; h++) {
                              if ((h!=i)&&(a[h][i]!=0)) {
                                          for (int w=0; w<=lngth-1; w++) {
                  if ((x!=1)&&(x!=0)) {
                        for (int m=0; m<=lngth-1; m++) {      
                  if  ((!(i==j))&&(y!=0)) {                        
                        for (int k=0; k<=lngth-1; k++) {      
                        float s=(b[i]*y), t=(b[j]);
                        if (s-t==0) {
                        } else {
      cout << '\n';                                                                              
      for (int l=0; l<=lngth-1; l++) {                                                
            cout << char('a'+l) << "=" <<setprecision(20) << z[l] <<"\n";
return 0;      
Don't you think some more explanation is required?
Do your own linear algebra homework. Hint: your professor will know that BLAS at netlib is too complex for you to write yourself. Please remember to strip off the comments so that it's not too obvious. He/she will still recognize it, of course.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I am willing to help but I am not going to do it for you.  Post some code.
Can you solve AX=B with gauss elimination?? I thought gauss elimination was for equations like ax² +bx + c = 0.
the solution for AX=B is X=B/A isn't it??
Or is it so long ago that i'm wrong?

Well, yes, if you want to use Gauss-Jordan elimination to compute A¯¹
All Courses

From novice to tech pro — start learning today.