some fixes

master
serr 2025-05-12 22:58:09 +03:00
parent 6da915f09a
commit 49aed84225
2 changed files with 12 additions and 2 deletions

View File

@ -151,6 +151,10 @@ void print_polynomial(Polynomial *p, char letter) {
for (int i = 0; i < p->size; i++) {
Term term = p->terms[i];
if (term.coefficient == 0) {
continue;
}
// Печать знака (не печатаем '+' перед первым слагаемым)
if (i != 0 || term.coefficient < 0) {
printf("%c", term.coefficient > 0 ? '+' : '-');

View File

@ -5,3 +5,9 @@ print A;
B = 1;
A = x + B;
print A;
A = (x-2)*(x^2+2*x+4);
print A;
print 2+2*3;