HUUZHEN / -homework2

0 stars 0 forks source link

suggestions for the program #1

Open kiol1812 opened 3 days ago

kiol1812 commented 3 days ago

You are missing the following things:

  1. operator>>
  2. operator<<

    class Polynomial {
    friend ostream& operator<<(ostream& os, const Polynomial& p);
    friend istream& operator>>(istream& is, Polynomial &p);
    // ...
    istream& operator>>(istream& is, Polynomial &p){
    // paste your input function here, and replace all "cin" with "is".
    // assign newterm(coef, exp) to "p".
    // for example
    is >> coef >> exp;
    p.NewTerm(coef, exp);
    return is;
    }
    int main(){
    polynomial poly1, poly2;
    
    cout << "輸入第一個多項式:" << endl;
    // poly1.input();
    cin>>poly1;
    //...
    }
    ostream& operator<<(ostream& os, const Polynomial& p){
    // paste your display function here, and replace all "cout" with "os".
    // assign data member to "p".
    // for example
    os << p.termArray[i].coef;
    return os;
    }
    int main(){
    //...
    cout << "多項式相加結果: ";
    // sum.display();
    cout<<sum;
    //...
    }

    You can refer to 2024-11-20 資料結構教材.pdf.

kiol1812 commented 3 days ago

report composition issue

refer to this. ... 其中您的報告需要有以下部分:

解題說明(15%) 程式實作(30%) 效能分析(10%) 測試與驗證(20%) 申論及開發報告(25%) ...