/**************************************************** * Elementary operations on Polynomial Fractions * * ------------------------------------------------- * * Ref.: "Mathématiques en Turbo-Pascal By M. Ducamp * * and A. Reverchon (vol 2), Eyrolles, Paris, 1988" * * [BIBLI 05]. * * ------------------------------------------------- * * Note: any program concerning polynomial fractions * * must be linked with files polynoms.cpp and * * polfract.cpp. * * * * C++ version by J-P Moreau, Paris. * * (www.jpmoreau.fr) * ****************************************************/ #include #include #include "polynoms.h" #include "polfract.h" //define type ar_fraction //------------------------------------------------------- //Enter a polynomial fraction, example: x2 -5x +4 / x2 -1 // INPUT: tx prompting message // OUTPUT: F(x)=P(x)/Q(x) of type ar_fraction // USES: Function EnterPolynom (of file polynoms.cpp) //------------------------------------------------------- bool EnterPolFract(char *tx, ar_fraction *F) { int i; for (i=1; i<4; i++) { printf("%s\n",tx); if (EnterPolynom(" P(x) = ",&F->numer)) if (EnterPolynom(" Q(x) = ",&F->denom)) return TRUE; } printf("\n"); return FALSE; } //------------------------------------------------------- //Display to screen a polynomial fraction F(x)=P(x)/Q(x) //of type ar_fraction. //USES: Function DisplayPolynom (of file polynoms.cpp) //------------------------------------------------------- void DisplayPolFract(ar_fraction *F) { printf("\n\n"); DisplayPolynom(&F->numer); printf("\n"); if (F->denom.degree>0 || F->denom.coeff[0].value!=1) { printf(" -------------\n"); DisplayPolynom(&F->denom); printf("\n"); } } //end of file polfract.cpp (june 2001).