0

I am making a program for my class where I handle equation problems such as:

2a-3b+5c=10

3a-2b-3c=-5 where the answer would be:

5a-5b+2c=5

This is what I have so far. It still isn't perfect cause I still haven't figured out the "=" part. I do have it performing the math though. But the answers are coming as:

5a5b5c-5a5b5c+2a2b2c. I don't understand why. Any help would be much appreciated.

```
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
// Declarations
const int length=26;
int num_var,
i,j;
char variable_array [length];
int equ_1 [length],
equ_2 [length];
int main()
{
cout<< "How many variables are in your equation?" <<endl;
cin>> num_var;
cout<< "Enter the variables for the first equation," <<endl;
cout<< "while entering a negative sign if the preceding" <<endl;
cout<< "operator is a minus sign." <<endl;
for (i=0; i<26 && i<num_var; i++)
{
cin>> equ_1[i];
}
cout<< "Enter the variables for the second equation," <<endl;
cout<< "while entering a negative sign if the preceding" <<endl;
cout<< "operator is a minus sign." <<endl;
for (i=0; i<26 && i<num_var; i++)
{
cin>> equ_2[i];
}
strcpy (variable_array, "abcdefghijklmnopqrstuvwxyz");
for (i=0; i<26 && i<num_var; i++)
{
equ_1[i] = equ_1[i] + equ_2[i];
}
cout<< "Your answer is:";
for (i=0; i<26 && i<num_var; i++)
{
for (j=0; j<26 && j<num_var; j++)
{
cout<< equ_1[i] << variable_array[j];
}
}
}
```