-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab1.cpp_typescript
executable file
·50 lines (42 loc) · 1.86 KB
/
lab1.cpp_typescript
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
Script started on Sat 05 Apr 2014 09:08:21 PM PDT
lps1994@uw1-320-08:~/CSS343/Lab1$ g++ lab1.cpp poly.cpp
lps1994@uw1-320-08:~/CSS343/Lab1$ valgrind./a.ot[Kut d./a.out[C[1P./a.out[1P./a.outd./a.out ./a.out[C[C[C[C[C[C[C
==17149== Memcheck, a memory error detector
==17149== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==17149== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==17149== Command: ./a.out
==17149==
Enter terms for polynomial A. Enter a coefficient
then exponent for each term. Enter -1 -1 to terminate.
5 7 -4 3 10 1 -2 0 -1 -1
Enter terms for polynomial B. Enter a coefficient
then exponent for each term. Enter -1 -1 to terminate.
3 4 1 3 -1 -1
A = +5x^7 -4x^3 +10x -2
B = +3x^4 +1x^3
Compute C = A + B: +5x^7 +3x^4 -3x^3 +10x -2
A is not == B
A is not == B
Compute Z1 = A2 - B2: +5x^7 -3x^4 -5x^3 +10x -2
Compute Z2 = B2 - A2: -5x^7 +3x^4 +5x^3 -10x +2
Compute D = A * B - 15
Before: D = +5x^7
After: D = +15x^11 +5x^10 -12x^7 -4x^6 +30x^5 +4x^4 -2x^3 -15
Test assignment operators
X = +15x^11 +5x^10 -12x^7 -4x^6 +30x^5 +4x^4 -2x^3 -15
Y = -15x^11 -5x^10 +17x^7 +4x^6 -30x^5 -4x^4 -2x^3 +10x -2
Get and Set coefficient
coeff of subscript 0 of D is: -15
Doing getCoeff for term -20000
D = +50x^20000 +15x^11 +5x^10 -12x^7 -4x^6 +30x^5 +4x^4 -2x^3 +50
==17149==
==17149== HEAP SUMMARY:
==17149== in use at exit: 0 bytes in 0 blocks
==17149== total heap usage: 35 allocs, 35 frees, 80,836 bytes allocated
==17149==
==17149== All heap blocks were freed -- no leaks are possible
==17149==
==17149== For counts of detected and suppressed errors, rerun with: -v
==17149== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
lps1994@uw1-320-08:~/CSS343/Lab1$ exit
Script done on Sat 05 Apr 2014 09:10:07 PM PDT