Thread: linked lists of a polynomial

  1. #1

    linked lists of a polynomial

    Hi every one, I'm very new in c++ programming, and I'm encounting some difficulties with my program. It's supposed to create a polynomial with a linked list. It keeps giving me errors and I don't know what to do anymore. The polynomial is created with a single nested statement in the constructor. But it doesn't seem to work. Please help me.

    class Term
    Term (double coefficient, int exponent=0, Term *next=NULL);
    double evaluate (double x);
    void print();
    double coefficient;
    int exponent;
    Term *next;

    Term::Term(double coefficient, int exponent = 0, Term *next = NULL)
    Term *pt = new Term(1,10, new Term(-3,4,new Term (17)));

    double Term::evaluate (double x);
    if (Term *pt != NULL)
    while(pt->next != NULL)
    int expo = ptr->exponent;
    double accum+ = ptr->coefficient * pow(x, expo);
    ptr->next = NULL;
    return accum;

    int main()
    Term test;
    double result = test.evaluate (2);
    cout << "and the answer is: " << result << endl;
    return 0;

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Did you double click the send button or something?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  2. Map file formats and linked lists
    By Spitball in forum Game Programming
    Replies: 2
    Last Post: 03-04-2004, 11:32 PM
  3. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  4. linked lists of a polynomial
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 02-11-2002, 07:51 PM
  5. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 06:25 PM