-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoly_class.cpp
More file actions
74 lines (55 loc) · 1.77 KB
/
poly_class.cpp
File metadata and controls
74 lines (55 loc) · 1.77 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* -----------------------------------------------------------------------------
FILE NAME: poly_class.cpp
DESCRIPTION: This is a test driver for my polynomial class. It test the class functions to ensure that they are all working
USAGE: all that has to be done is to compile the code and run the program. no user interface due to this being a test drive file. Test script named test.sh is available
COMPILER: g++ compiler c++11 standard
NOTES:
----------------------------------------------------------------------------- */
#include "Polynomial.h" //Specification file
int main(int argc, char* argv[])
{
Polynomial poly[3];
for(int n = 0; n < 2; ++n)
{
cin >> poly[n];
cout << poly[n];
}
cout << "\nTesting addition: ";
poly[2] = (poly[0] + poly[1]);
cout << poly[2];
cout << "\nTesting subtraction: ";
//Polynomial sub;
poly[2] = (poly[0] - poly[1]);
cout << poly[2];
cout << "\nTesting multiplication: ";
poly[2] = (poly[0] * poly[1]);
cout << poly[2];
cout << endl;
cout << endl;
Polynomial te, mt;
te = poly[0] = poly[1];
cout << "\nTesting assignment";
cout << "\noriginal: ";
cout << poly[1];
cout << "\ncopy: ";
cout << te;
cout << "\nTesting equivalency operator";
cout << "\nTest for " << te << " equal to " << poly[1];
te == poly[1];
cout << "\nTest for " << te << " equal to " << poly[2];
te == poly[2];
cout << "\nTesting function evaluation for\n" << te;
te(5);
cout << "\nTesting function differentiation: ";
mt = te--;
cout <<"\n" << mt;
cout << "\nTesting function integration: ";
mt = te++;
cout <<"\n" << mt;
cout << endl;
cout << endl;
cout << "Programmed by: " << PROGRAMMER_NAME << " -- ";
cout << __DATE__ << " " __TIME__ << endl;
cout << endl;
return 0;
}