0

I can get my code to compile and produce correctly (as I want it right now), except for one problem:

Output:

```
What Degree Polynomial: 2
Enter Coefficient #: 8
Enter Coefficient #: 5
Polynomial selected is: 8x^(0)5x^(1)
What Degree Polynomial: 3
Enter Coefficient #: 4
Enter Coefficient #: 5
Enter Coefficient #: 6
Polynomial selected is: 4x^(1)+5x^(2)+6x^(3)+Press any key to continue . . .
```

As you can see, my outputs are smashed together, without the proper addition symbol (i.e 8x^(0) + 5x^(1) + ....)

This is my code:

```
#include <iostream>
using namespace std;
class Polynomial
{
public:
void Polynomial1 ();
void Polynomial2 ();
int Degree;
int *coef1, *coef2;
int *power1, *power2;
private:
static const int ConstValue=3;
};
int main()
{
Polynomial Poly1,Poly2;
Poly1.Polynomial1();
cout << endl;
Poly2.Polynomial2();
return 0;
}
void Polynomial::Polynomial1()
{
int i,n;
cout << "What Degree Polynomial: ";
cin >> i;
coef1 = new (nothrow) int[i];
power1 = new (nothrow) int[i];
for (n= 0; n<(i); n++)
{
cout << "Enter Coefficient #: ";
cin >> coef1[n];
}
for (n=0;n<(i);n++)
{
power1[n]= n;
}
cout << "Polynomial selected is: ";
for (n=0;n<(i);n++)
{
cout << coef1[n] << "x^(" << power1[n] << ")";
}
}
void Polynomial::Polynomial2()
{
int h,j;
cout << "What Degree Polynomial: ";
cin >> h;
coef2 = new (nothrow) int[h];
power2 = new (nothrow) int[h];
for (j= 1; j<=h; j++)
{
cout << "Enter Coefficient #: ";
cin >> coef2[j];
}
for (j=1;j<=h;j++)
{
power2[j]= j;
}
cout << "Polynomial selected is: ";
for (j=1;j<=h;j++)
{
cout << coef2[j] << "x^(" << power2[j] << ")" << "+";
}
}
```

I can't figure out how to put the code in properly to address the addition symbol so that my answers end properly, and don't have a hanging addition symbol (i.e. Polynomial selected is: 4x^(1)+5x^(2)+6x^(3)+ )

*Edited
by PDB1982*: n/a