Sams Teach Yourself C++ in 21 Days

(singke) #1
Templates 687

19


If you are using a Microsoft compiler, uncomment line 67. Based on the C++
standards, this line should not be necessary; however, it is needed to com-
pile with the Microsoft compiler.

NOTE


Line numbers have been added to the output to make analysis easier. Line
numbers will not appear in your output.

NOTE


First run
1: animal() animal() animal() Enter an offset (0-2) and a value.
➥(-1 to stop): 0 0
2: Enter an offset (0-2) and a value. (-1 to stop): 0 1
3: Enter an offset (0-2) and a value. (-1 to stop): 1 2
4: Enter an offset (0-2) and a value. (-1 to stop): 2 3
5: Enter an offset (0-2) and a value. (-1 to stop): -1 -1
6: animal(int) Destroyed an animal...animal(int) Destroyed an
➥animal...animal(int) Destroyed an animal...initArray...
7: [0] 0
8: [1] 1
9: [2] 2
10:
11: animal array...
12: [0] 0
13: [1] 10
14: [2] 20
15:
16: Destroyed an animal...Destroyed an animal...Destroyed an animal...
Second run
1: animal(int) Destroyed an animal...
2: animal(int) Destroyed an animal...
3: animal(int) Destroyed an animal...
4: Enter an offset (0-9) and a value. (-1 to stop): 0 0
5: Enter an offset (0-9) and a value. (-1 to stop): 1 1
6: Enter an offset (0-9) and a value. (-1 to stop): 2 2
7: Enter an offset (0-9) and a value. (-1 to stop): 3 3
8: animal(int)
9: Destroyed an animal...
10: animal(int)
11: Destroyed an animal...
12: animal(int)
13: Destroyed an animal...
14: initArray...

OUTPUT

Free download pdf