#include <iostream>
void printPolynom(double* coefs, int degree, std::ostream& os)
{
static const char VAR = 'x';
bool first = true;
for (int i = degree; i >= 0; --i) {
double coef = *coefs;
coefs++;
if (!first && coef > 0.0) {
os << "+";
}
first = false;
os << coef;
for (int j = 0; j < i; ++j)
os << '*' << VAR;
}
}
int main()
{
const int degree = 3;
double coefs[degree + 1] = { 9, 3, 12, -1 };
printPolynom(coefs, degree, std::cout);
std::cout << "\nDone";
return 0;
}