Question: Please complete the program to balance chemical equations. #include #include using namespace std; const int MAXELEM = 3 0 ; string names [ MAXELEM ]

Please complete the program to balance chemical equations.
#include
#include
using namespace std;
const int MAXELEM =30;
string names[MAXELEM];
int nElem =0;
long long linsys[MAXELEM][MAXELEM];
long long gcd(long long a, long long b)
{
if (b ==0)
return a;
return gcd(b, a%b);
}
int getIndex(string ename)
{
for(int i=0; i 0)
coeffs[index]= val;
else
coeffs[index]=1;
}
}
}
bool solve(long long a[MAXELEM][MAXELEM], int n, int m, long long soln[])
//
// solve linear system on n equations with m unknowns, checking
// for unsolvable systems
{
if (n < m)
return false;
for(int i=0; i=0; i--){
long long val = a[i][m];
for(int j=i+1; j> r >> p;
while (r >0){
icase++;
nElem =0;
for(int i=0; i> term;
for(int j=0; j> term;
for(int j=0; j 1 && i < r+p){
factor = gcd(factor, soln[i]);
i++;
}
cout << soln[0]/factor;
for(int i=1; i> r >> p;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!