📄 main.cpp
字号:
#include"Polynomial.cpp"
#include<iostream.h>
int main()
{
Polynomial a(10),b(10);
int n,m,exp;
float coaf;
m=10;
cout <<"if want to add new term to Polynomial a entering 1,enter 0."<<endl;
cin>>n;
while(n&&m--)
{
cout<<"coaf:"<<endl;
cin>>coaf;
cout<<"exp:"<<endl;
cin>>exp;
a.NewTerm(coaf,exp);
cout <<"if want to add new term entering 1,enter 0."<<endl;
cin>>n;
}
cout<<"Entering Polynomial a is over"<<endl;
cout <<"if want to add new term to Polynomial b entering 1,enter 0."<<endl;
cin>>n;
m=10;
while(n&&m--)
{
cout<<"coaf:"<<endl;
cin>>coaf;
cout<<"exp:"<<endl;
cin>>exp;
b.NewTerm(coaf,exp);
cout <<"if want to add new termto Polynomial b entering 1,enter 0."<<endl;
cin>>n;
}
cout<<"Entering Polynomial b is over"<<endl;
cout<<"when x is 2.5 ,a is"<<a.Eval(2.5)<<endl;
cout<<"when x is 2.5 ,b is"<<b.Eval(2.5)<<endl;
a.Add(b);
cout<<"when x is 2.5 ,a is"<<a.Eval(2.5)<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -