Current location - Training Enrollment Network - Mathematics courses - Mathematical c multiplication
Mathematical c multiplication
# Contains? & ltstdio.h & gt

# Contains? & ltstdlib.h & gt

typedef? struct? Node? {

int? Coefficient,? Power;

struct? Node *? Next;

} time limit;

term*? new_term(int? Coefficient,? int? Power)? {

term*? t? =? (term *)malloc(sizeof(term));

t->; Next? =? NULL

t->; Coefficient? =? Coefficient;

t->; Power? =? Power;

Return? t;

}

Invalid? free_term(term*? t)? {

Free (t);

}

typedef? struct? List? {

Term? Head;

} polynomial;

Invalid? Init _ polynomial (polynomial *? p)? {

p->; Head. Next? =? NULL

}

Invalid? Clear _ polynomial (polynomial *? p)? {

term*? t? =? p->; head.next

term*? del

What time? (t? ! =? NULL)? {

Del? =? t;

t? =? t->; Next;

Freedom clause (del);

}

p->; Head. Next? =? NULL

}

Invalid? Insert _ polynomial (polynomial *? p,? term*? t)? {

t->; Next? =? p->; head.next

p->; Head. Next? =? t;

}

Invalid? Sorting (polynomial *? p)? {

term*? t;

term*? Next;

int? Done? =? 0,? Temperature;

What time? (! End)? {

Done? =? 1;

t? =? p->; head.next

What time? (t? ! =? NULL)? {

Next? =? t->; Next;

What if? (Next? ! =? NULL)? {

What if? (t->; Power? & lt? Next-> Power)? {

Temporary workers? =? t->; Coefficient;

t->; Coefficient? =? Next-> Coefficient;

Next-> Coefficient? =? Temperature;

Temporary workers? =? t->; Power;

t->; Power? =? Next-> Power;

Next-> Power? =? Temperature;

Done? =? 0;

}

}

t? =? Next;

}

}

}

Invalid? Combination (polynomial *? p)? {

term*? t? =? p->; head.next

term*? Next;

What time? (t? ! =? NULL)? {

Next? =? t->; Next;

What if? (Next? ! =? NULL? & amp& amp? Next-> Power? ==? t->; Power)? {

t->; Coefficient? +=? Next-> Coefficient;

t->; Next? =? Next-> Next;

Free _ $ TERM (next);

}

Or what? {

t? =? Next;

}

}

}

Invalid? Multiplication (polynomial *? p 1,? Polynomial *? p2,? Polynomial *? p3)? {

term*? t 1? =? p 1->; head.next

term*? T2;

Clear _ polynomial (P3);

Init _ polynomial (p3);

What time? (t 1? ! =? NULL)? {

t2? =? p2->; head.next

What time? (t2? ! =? NULL)? {

Insert _ Polynomial (p3,? new _ term(t 1->; Coefficient * T2-& gt;; Coefficient,? t 1->; Power? +? T2->; Power));

t2? =? T2->; Next;

}

t 1? =? t 1->; Next;

}

Sorting (P3);

Combination (P3);

}

Invalid? Input (polynomial *? p)? {

int? coef? Power;

Charles? c;

Init _ polynomial (p);

What time? (really)? {

scanf("%d%d ",& ampcoef? & Power);

Insert _ polynomial (p,? New _ $ TERM (coef));

c? =? getchar();

What if? (c? ==? \n ')? Break;

}

Sorting (p);

Combination (p);

}

Invalid? Output (polynomial *? p)? {

term*? t? =? p->; head.next

What time? (t? ! =? NULL)? {

printf("%d? %d? ”,? t->; Coefficient,? t->; Power);

t? =? t->; Next;

}

}

int? main()? {

int? Me;

Polynomial? p[3];

For what? (me? =? 0; ? Me? & lt? 3; ? i++)? {

Init _ polynomial (& AMPP [I]);

}

For what? (me? =? 0; ? Me? & lt? 2; ? i++)? {

Input (& AMPP [I]);

}

Multiplication (& ampp[0],? & ampp[ 1],? & ampp[2]);

Output (& AMPP [2]);

}