#include <iostream>
#include <math.h>
using namespace std;
class polynomial
{
protected:
int dgree; // it is used to store the dgree
double num[11]; // it is used to store a0,a1,a2...
public:
polynomial();
polynomial &operator=(const polynomial &);
void input(); // have done
double evaluate(); // have done
void print();
};
void polynomial::input()
{
int i;
for (i = 10; i--; i = 0)
{
cout << "please enter the a" << i;
cin >> num[i];
}
}
double polynomial::evaluate()
{
int i;
double x;
int ans = 0;
cout << "please enter your number.";
cin >> x;
for (i = 11; i--; i = 0)
{
ans = ans + num[i] * pow(x, i);
}
return ans;
}
void polynomial::print()
{
cout << num[10] << "x*x*x*x*x*x*x*x*x*x";
cout << num[9] << "x*x*x*x*x*x*x*x*x";
cout << num[8] << "x*x*x*x*x*x*x*x";
cout << num[7] << "x*x*x*x*x*x*x";
cout << num[6] << "x*x*x*x*x*x";
cout << num[5] << "x*x*x*x*x";
cout << num[4] << "x*x*x*x";
cout << num[3] << "x*x*x";
cout << num[2] << "x*x";
cout << num[1] << "x";
cout << num[0];
}
int main()
{
polynomial func;
func.input();
func.evaluate();
func.print();
return 0;
}
当我点击run code按钮后,终端显示这个页面
polynomial();
polynomial &operator=(const polynomial &);
这两个函数的函数体呢?