Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Polinomio& operator*(const Polinomio& a, const Polinomio& b)
- {
- Polinomio mult;
- if (a.cantidad > b.cantidad)
- {
- for (int i = 0; i < a.cantidad; i++)
- {
- for (int j = 0; j < b.cantidad; j++)
- {
- mult.coeficientes[j] = a.coeficientes[i] * b.coeficientes[j];
- mult.exponentes[j] = a.exponentes[i] + b.exponentes[j];
- }
- }
- }
- else
- {
- for (int i = 0; i < b.cantidad; i++)
- {
- for (int j = 0; j < a.cantidad; j++)
- {
- mult.coeficientes[i] = b.coeficientes[i] * a.coeficientes[j];
- mult.exponentes[i] = b.exponentes[i] + a.exponentes[j];
- }
- }
- }
- int cantidad2 = 0;
- for (int i = 0; i < 30; i++)
- {
- if (mult.coeficientes[i] != 0)
- {
- cantidad2++;
- }
- }
- mult.cantidad = cantidad2;
- mult.ordenar_Polinomio();
- return mult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement