-
Notifications
You must be signed in to change notification settings - Fork 0
/
Polynomial.h
46 lines (35 loc) · 1.55 KB
/
Polynomial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* -----------------------------------------------------------------------------
FILE NAME: Polynomial.h
DESCRIPTION: This is the header file for Polynomial.cpp that contains the definition of the class as well as all the the #define and #include
USAGE: linked to other files via .o file
COMPILER: g++ compiler c++11 standard
NOTES: used pragma once instead of the Def h syntax.
----------------------------------------------------------------------------- */
//Header file for polynomial.cpp
#pragma once
#include <iostream>
#include <cmath>
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define ARRAY_SIZE(a) sizeof(a)/sizeof(a[0])
using namespace std;
class Polynomial
{
friend ostream& operator << (ostream &strm, const Polynomial &p);
friend istream& operator >> (istream &istrm, Polynomial &p);
private:
int degree; //Degree of the polynomial
int coef[9]; //Array of Coefficients
public:
Polynomial();
~Polynomial();
Polynomial(const Polynomial &);
Polynomial(int kr, int coe[9]);
Polynomial operator +(const Polynomial &); //Overloaded + operator used to add two polynomials
Polynomial& operator =(const Polynomial &); //Overlaoded = operator used to set two polynomials equal to eachother
Polynomial operator -(const Polynomial &); // overloaded - operator used to set a polynomial equal to another one
Polynomial operator *(const Polynomial &);
Polynomial operator ==(const Polynomial &);
Polynomial operator ()(const float &);
Polynomial operator --(int k);
Polynomial operator ++(int j);
};