CS-212
Lab 2

Given the file poly.c

  • Replace the TERM macro with an equivalent function.
  • Write a function that will add two polynomials together and assign the result to a third polynomial.
  • Replace the code that prints the answer in poly.c with an equivalent function that will print "any" polynomial. Test your program as follows:
    1. create and initialize the following polynomials:
      p1 = 3x4 + 2x3+x2+2X+1
      p2 = 3x9 + 2x3+1
      p3 = 3x6 +1
    2. Use your add function to add the following polynomials together:
      p4 = p1 + p2
      p5 = p3 + p4
    3. Use your print function to print out all polynomials
  • Make sure that all of your code is documented; each function should have a set of header comments that includes:
  • The program should also contain a block of comments that includes:
  • Make sure that you create a README file to explaing any idiosyncracies of your program to the TA.
  • Once you have submitted your lab to the server send a note to your TA that it is ready for grading.

    Last updated: 02/14/2010 - RVS