Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

=+ f. instituting laws against driving while intoxicated

Answered: 1 week ago