cout affects memory contents?

I've been building a basic matrix class (based on Capper's book) to do some other work. While testing the class and functions, I noticed that the result I get for my transpose function changes whether or not it is displayed (using cout) before I use my multiply function. For example, if I do things in this order:

"transpose matrix A, multiply 2 (other) matrices, display transpose(A)"

transpose(A) comes out wrong but if the code executes in this order:

"transpose matrix A, display transpose(A), multiply 2 (other) matrices, display transpose(A)"

matrix A is fine. How can cout change the contents of memory? I've posted the source code at

https://filebox.vt.edu/users/dmennitt/matrixcpp/

where I've hilighted which statements change the results. weird. thanks for any light you can shed on this.

Topic archived. No new replies allowed.