Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Polynomial {
- int a, b, c, functionValue;
- public:
- Polynomial (int, int, int);
- static void functionValue(Polynomial);
- };
- Polynomial::Polynomial (int x, int y, int z) {
- a = x;
- b = y;
- c = z;
- }
- void Polynomial::functionValue(Polynomial x) {
- for (int i = 0; i < 5; i++) {
- x.functionValue = x.a * pow(i, 2) + x.b * i + x.c;
- cout << "The value of the function for x = " << i << " is " << x.functionValue;
- }
- }
- int main () {
- Polynomial poly (2, 3, 5);
- Polynomial::functionValue(poly);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment