本文整理汇总了C++中Polynomial::readFromUser方法的典型用法代码示例。如果您正苦于以下问题:C++ Polynomial::readFromUser方法的具体用法?C++ Polynomial::readFromUser怎么用?C++ Polynomial::readFromUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polynomial
的用法示例。
在下文中一共展示了Polynomial::readFromUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char * argv[]) {
Polynomial poly;
Polynomial poly2;
Polynomial poly3;
poly.readFromUser();
poly2.readFromUser();
cout << "poly: ";
poly.print();
cout << "poly2: ";
poly2.print();
cout << "poly3 = poly2 + poly: ";
poly3 = poly+poly2;
poly3.print();
cout << "poly2 before being multiplied by 3: ";
poly2.print();
poly2.multyPoly(3);
cout << "after ";
poly2.print();
poly = -poly;
cout << "poly being negated: ";
poly.print();
cout << "poly3's coefficient for 5th degree: " << poly3.coefficient(5) << endl;
poly3.changeCoefficient(10, 5);
cout << "after changing poly3's 5th degree coefficient to 10: " << poly3.coefficient(5) << endl;
cout << "highest degree of poly2: " << poly2.degree() << endl;
return 0;
}